嗨大家我得到了重复的第一条记录,并且知道只有一条记录,但它似乎改变了第二条的批号。请帮忙:(
SQL
Select A.ID
, A.lotnumber
, A.title
, A.department
, A.seller
, A.buyer
, A.soldfor
, A.status
, B.memberid
, B.paddlenumber
From sessionproducts A
Left
Join buyers B
on B.memberid = A.buyer
WHERE A.auction = 4
AND A.session = 1
ORDER
BY A.lotnumber ASC
返回
+----+-----------+-------------------------------+------------------+--------+-------+---------+--------+----------+--------------+
|ID | lotnumber | title | department | seller | buyer | soldfor | status | memberid | paddlenumber |
+----+-----------+-------------------------------+------------------+--------+-------+---------+--------+----------+--------------+
|85 | 1 | A Pair of Staffordshire | Decorative Arts | 47 | 160 | 600 | Sold | 160 | 317 |
| | | Figures of King Charles Sp... | | | | | | | |
+----+-----------+-------------------------------+------------------+--------+-------+---------+--------+----------+--------------+
|85 | 1 | A Pair of Staffordshire | Decorative Arts | 47 | 160 | 600 | Sold | 160 | 811 |
| | | Figures of King Charles Sp... | | | | | | | |
+----+-----------+-------------------------------+------------------+--------+-------+---------+--------+----------+--------------+
答案 0 :(得分:2)
在buyers
表中,您似乎至少有两条记录具有相同的memberid
但不同的paddlenumber
。