SQL statement question

2010-02-10 11:32 pm
Hi ALL

I have two tables, table a and table b.

table a
po_no buyer color size
12345 abc blue XXL

table b
po_no buyer color size style
.......... abc blue XXL AAA
.......... abc blue XXL BBB
.......... abc blue XXL CCC

How could I write a SQL statement to lookup table b po_no from table a po_no

Requirement:
Buyer, Color and Size in table a = Buyer, Color and Size in table b

Hugo

回答 (2)

2010-02-20 11:33 pm
無最佳解答
2010-02-11 6:47 pm
Do you mean the po_no is missing in tableb and you want to lookup the po_no in tablea?
Try following SQL
SELECT a.po_num, b.buyer, b.color, b.size, b.style
FROM tablea a, tableb b
WHERE a.buyer = a.buyer
AND a.color = b.color
AND a.size = b.size


收錄日期: 2021-04-21 16:54:59
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20100210000051KK00777

檢視 Wayback Machine 備份