关于MySQL JOIN或WHERE语句的问题
以下是我使用的SQL语句:关于MySQL JOIN或WHERE语句的问题,mysql,join,Mysql,Join,以下是我使用的SQL语句: SELECT a.Customer_ID, a.Customer_Name,c.Service_ID , c.Service_Name,f.Service_Type,c.Service_Price , e.Bill_ID, e.Bill_Day, e.Due_Bill_Day FROM customers a,customer_service b,services c , billing_ser
SELECT a.Customer_ID, a.Customer_Name,c.Service_ID
, c.Service_Name,f.Service_Type,c.Service_Price
, e.Bill_ID, e.Bill_Day, e.Due_Bill_Day
FROM customers a,customer_service b,services c
, billing_services d, billing e, services_type f
WHERE a.Customer_ID = b.Customer_ID AND b.Service_ID = c.Service_ID
AND c.Service_ID = d.Service_ID AND d.Bill_ID = e.Bill_ID
AND c.Service_Type = f.ID
我对SQL语句有几个问题。
1我可以知道上面的语句与使用join相同吗?(表演?)
2如果重复,我想让结果显示一次,账单对账单的差异结果显示两次
多谢各位
SELECT max(a.Customer_ID), max(a.Customer_Name),max(c.Service_ID)
, max(c.Service_Name),max(f.Service_Type),max(c.Service_Price)
, max(e.Bill_ID), max(e.Bill_Day), max(e.Due_Bill_Day)
FROM customers a inner join customer_service b on(a.Customer_ID = b.Customer_ID) inner join services c on (b.Service_ID = c.Service_ID)
inner join billing_services d on(c.Service_ID = d.Service_ID) inner join billing e on(d.Bill_ID = e.Bill_ID ) inner join services_type f on( c.Service_Type = f.ID)
group by a.Customer_ID, a.Customer_Name,c.Service_ID
, c.Service_Name,f.Service_Type,c.Service_Price
, e.Bill_ID, e.Bill_Day, e.Due_Bill_Day
试试这个代码谢谢你的回答,我得到了同样的结果。那么,它会获得更高的性能吗?