Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ObiJuan
Starting Member
2 Posts |
Posted - 2009-10-05 : 13:33:06
|
I’m using a query to join tables. However, if there is a duplicate, it only selects one record. I attached screenshots of the table and query. The first image is the table with the duplicate records highlighted, and the second is the query showing only 1 of the duplicates. SQL statement is below:SELECT tblSnapfishReturns.[Transaction ID], tblSnapfishReturns.NegAmount AS Amount, tblSnapfishReturns.Date FROM tblSnapfishReturnsUNION SELECT tblCardSales.[PMT ID], tblCardSales.[total sale], tblCardSales.[shipping time]FROM tblCardSales; |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-10-05 : 13:36:08
|
| use UNION ALL instead of UNION |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-10-05 : 13:38:35
|
| yes exactly :) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ObiJuan
Starting Member
2 Posts |
Posted - 2009-10-05 : 14:35:31
|
| WOW - I just got back from lunch and saw it was already solved. Thanks for the lighting fast response.UNION ALL worked like a charm. Thank you!! |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|