Table 1 userID | Name 0001 | Tim 0002 | James 0003 | Bond 0004 | Steve 0005 | Bill Table 2 ProductID | BuyerID | SellerID 00001 | 0001 | ooo4 00002 | 0003 | 0005 00003 | 0001 | 0002 How to make this ProductID | Buyer | Seller 00001 | Tim | Steve 00002 | Bond | Bill 00003 | Tim | James
-- TABLE_1 (USERID, NAME) -- TABLE_2 (PRODUCTID, BUYERID, SELLERID) SELECT A.PRODUCTID, B.NAME, C.NAME FROM TABLE_2 A INNER JOIN TABLE_1 B ON A.BUYERID = B.USERID INNER JOIN TABLE_1 C ON A.SELLERID = C.USERID ORDER BY A.PRODUCTID
Select p.ProductID,b.Name as Buyer,s.Name as seller from table2 p,table1 s,table1 b where p.BuyerID=b.UserID and p.SellerID=s.UserID
WHERE
JOIN
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)