使用条件连接和选择查询 [英] using conditional join and select query
本文介绍了使用条件连接和选择查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有账户和missinginfo表。
我想根据账户表的id显示missinginfo表中的列..
我正在使用加入查询..我的查询有问题任何人都可以帮助我。
这里是查询
SELECT missinginfo.Name,missinginfo.fathername,missinginfo.details,account.id
FROM missinginfo
INNER JOIN account
ON missinginfo.id = account.id 其中 account.username = session [ ' username'];
解决方案
我猜你只是想表示你想要显示缺少的信息,即使找不到匹配的帐户。你可能想要查看OUTER JOIN
。
祝你好运!
我自己更正了..就像这样...
SELECT missinginfo.Name,missinginfo.fathername,missinginfo.details,account.id
FROM missinginfo
INNER JOIN 帐户
ON missinginfo.id = account .id 其中 account.username = ' abc @ abc。 com公司跨度>;
i have accounts and missinginfo table .
I want to show columns from missinginfo table on the basis of id of the account table..
I am using join query for it.. i have a problem with the query can anyone help me .
here is the query
SELECT missinginfo.Name, missinginfo.fathername, missinginfo.details,account.id
FROM missinginfo
INNER JOIN account
ON missinginfo.id=account.id where account.username=session['username'];
解决方案
I guess you just mean you want to show the missing info even if no matching account can be found. You might want to look intoOUTER JOIN
for that.
Good luck!
I have corrected it myself.. its like this...
SELECT missinginfo.Name, missinginfo.fathername, missinginfo.details,account.id FROM missinginfo INNER JOIN account ON missinginfo.id=account.id where account.username='abc@abc.com';
这篇关于使用条件连接和选择查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文