我创建了两个表:
Name:table1,table2
table1 consists of:id,name,contactnumber
101,john,9955443322
102,peter,9955443311
table2 consists of:id,place,date
101,chennai,15-05-2014
102,munbai,13-05-2014
select table1.id
,table1.contactnumber
,table2.date
from table1,table2
where table2.date = 29-09-2014
&& table2.loannumbers=table1.loannumber
但返回空结果集。
我想显示列:
id,name,date
我想显示行:
(table2)date=15-05-2014 and (table1)id=id(table2).
答案 0 :(得分:0)
首先,不要将此语法用于表之间的联合。这是一种旧的学校符号,使用明确的联合将更具可读性。
以下是您正在寻找的查询:
SELECT T1.id
,T1.name
,T2.date
FROM table1 T1
INNER JOIN table2 T2 ON T2.id = T1.id
AND T2.date = '2014-05-15'
希望这会有所帮助。
答案 1 :(得分:0)
试试这个
SELECT table1.id, table1.name, table2.date
FROM table1
INNER JOIN table2 ON table1.id = table2.id;