交易内容如下:
表A有A1和A2列
表B有B1、B2、B3列
现在我想从A1和B1列中选择数据(不连接),条件是:-
B3=某个单词,A2=B2
如果不需要打印B1,我会把查询(没有连接)写成:
select A1 from A where A2 in (select B2 from B where B3= someword );
但是我需要同时打印A1和B1,那么,在不使用join和IN的情况下,有可能做到这一点吗???
交易内容如下:
表A有A1和A2列
表B有B1、B2、B3列
现在我想从A1和B1列中选择数据(不连接),条件是:-
B3=某个单词,A2=B2
如果不需要打印B1,我会把查询(没有连接)写成:
select A1 from A where A2 in (select B2 from B where B3= someword );
但是我需要同时打印A1和B1,那么,在不使用join和IN的情况下,有可能做到这一点吗???
当你说你需要将输出限制在A2=B2的位置时
您正在指定一个联接。
称之为其他东西并不能改变它的本质。。。用威利的话来说,
“以任何其他名称加入仍然是加入”
说真的,“Join”不是的名称,也不是单词,甚至不是用于应用它的查询中的语法,它是基于两个不同表的值的逻辑谓词或限制或过滤器。如果你需要将输出限制在表1.A2等于表2,B2的位置,那么你就有了一个连接
如果没有JOIN
,你就无法有效地做到这一点,或者换句话说,你可以使用插入选择
>,但这个操作要慢得多,比如JOIN
JOIN是最好的选择,它是通过编程和数据库编写的。当你把慢速IS卖给他时,你潜在的未来客户不会那么高兴。
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...
Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...
What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...