多表联合查询
Nop_Customer表
ID fromPT CustomerID email
1 hobbywow 10000 a@a.com
2 hobbywow 20000 b@b.com
3 rcmaster 20000 c@c.com
Nop_Order表
ID fromPT OrderID CustomerID
1 hobbywow 001 10000
2 hobbywow 002 20000
3 rcmaster 003 20000
fromPT+CustomerID两个标识对应
请问下怎么写才有如下结果
ID fromPT OrderID CustomerID email
1 hobbywow 001 10000 a@a.com
2 hobbywow 002 20000 b@b.com
3 rcmaster 003 20000 c@c.com
看清楚点CustomerID有重复记录
需要CustomerID+fromPT才能对应起来
------解决方案--------------------SELECT Nop_Customer.*,Nop_Order.OrderID,Nop_Order.CustomerID FROM
Nop_Customer,Nop_Order WHERE Nop_Customer.fromPT = Nop_Order.fromPT
AND Nop_Customer.CustomerID= Nop_Order.CustomerID
--如果可以根据ID,那最好用ID