EugeneDeWaal
EugeneDeWaal

Reputation: 228

SQL Join getting duplicates

Hi Guys Im getting a duplicate 1st record and know for a fact there is only one record but it seems to change the lot number for the second. Please help :(

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

Return

+----+-----------+-------------------------------+------------------+--------+-------+---------+--------+----------+--------------+
|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... |                  |        |       |         |    |      |          |
+----+-----------+-------------------------------+------------------+--------+-------+---------+--------+----------+--------------+

Upvotes: 0

Views: 40

Answers (1)

Carsten Massmann
Carsten Massmann

Reputation: 28196

In the buyers table you seem to have at least two records with the same memberid but different paddlenumbers.

Upvotes: 2

Related Questions