繁体   English   中英

从多个表中选择而不使用 join 和 union

[英]Select from multiple tables without using join and union

我有以下 SQL 查询:

SELECT t1.id as id,
       t1.username as username,
       CONCAT_WS(' ', t2.ad,t2.soyad) as fullname,
       t2.title as title,
       t3.pass as password,
       t3.phone_login as hat,
       t2.time as date
FROM kullanici t1, kullanici_tanim t2, dial_users t3
WHERE t1.id = t2.usr_id AND t1.agent_id = t3.user_id
GROUP  BY  t1.id
ORDER BY t1.id ASC

此查询工作正常。 我想知道的是我应该使用连接吗? 什么是正确的方法?

对于符合 ANSI-92 的代码,请使用连接。 例如:

SELECT   t1.id as id,
             t1.username as username,
             CONCAT_WS(' ', t2.ad,t2.soyad) as fullname,
             t2.title as title,
             t3.pass as password,
             t3.phone_login as hat,
             t2.time as date
FROM kullanici t1 
     INNER JOIN kullanici_tanim t2 
     ON t1.id = t2.usr_id 
     INNER JOIN dial_users t3
     ON t1.agent_id = t3.user_id
GROUP  BY  t1.id
ORDER BY t1.id ASC

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM