•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 374,021 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,781 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 3733 | Replies: 13
![]() |
•
•
Join Date: Aug 2006
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
SELECT COUNT(*), sID1, sID2, sID3 FROM ITEM_T
WHERE sItemID NOT IN (400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418,
419, 420, 421, 422, 423, 425, 426, 427, 428, 428, 706,707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718,
719, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 737, 738, 745, 746)
GROUP BY sID1, sID2, sID3
HAVING COUNT(*)>1
UNION
SELECT COUNT(*), sID1, sID2, sID3 FROM BANKITEM_T
WHERE sItemID NOT IN (400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418,
419, 420, 421, 422, 423, 425, 426, 427, 428, 428, 706,707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718,
719, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 737, 738, 745, 746)
GROUP BY sID1, sID2, sID3
HAVING COUNT(*)>1
ok this seems to work but i still need to check 100%
i dont think this is the best way
lorraine1000
WHERE sItemID NOT IN (400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418,
419, 420, 421, 422, 423, 425, 426, 427, 428, 428, 706,707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718,
719, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 737, 738, 745, 746)
GROUP BY sID1, sID2, sID3
HAVING COUNT(*)>1
UNION
SELECT COUNT(*), sID1, sID2, sID3 FROM BANKITEM_T
WHERE sItemID NOT IN (400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418,
419, 420, 421, 422, 423, 425, 426, 427, 428, 428, 706,707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718,
719, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 737, 738, 745, 746)
GROUP BY sID1, sID2, sID3
HAVING COUNT(*)>1
ok this seems to work but i still need to check 100%
i dont think this is the best way
lorraine1000
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,161
Reputation:
Rep Power: 7
Solved Threads: 58
That's exactly what I was going to suggest, as soon as I had established which list of items it needed to be.
The only other way is to add the list of ID's that you want into another table on their own and join on it.
The only other way is to add the list of ID's that you want into another table on their own and join on it.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
- how to delete duplicate record in a table by using SQL query (MS SQL)
- Cold Fusion Loop problem (ColdFusion)
- can you help - access (MS Access and FileMaker Pro)
Other Threads in the MS SQL Forum
- Previous Thread: Get table list from SQL 2k server
- Next Thread: Releasing unused DB space



Linear Mode