|
-
Sep 27th, 2000, 11:38 PM
#1
Thread Starter
Addicted Member
I need to find a way using the table scenario below to remove THE ROWS if the Store_Id and Customer_Id is the same but the Vendor_id is different. (Do not remove if Vendor_ID is the same)using SQl CODE. This list could go on an on in the table with various different number's and stores, etc.
(identity)
number_id Store_Id Vendor_Id Customer_Id Quantity
--------- | --------- | --------- | ----------- | --------
1 | 100 | 444 | 0 | 100
2 | 100 | 444 | 0 | 200
3 | 100 | 555 | 2 | 50
4 | 200 | 666 | 0 | 125
5 | 100 | 888 | 0 | 21
So essentially I would need the remove the last column using in this example using the logic from above.
I would be sincerely grateful for any guru coding examples/help!!!
-
Sep 28th, 2000, 03:08 AM
#2
Frenzied Member
I understood your question until you wrote
So essentially I would need the remove the last column using in this example using the logic from above.
does this help?
DELETE *
FROM Table1
WHERE ((Store_Id=Customer_Id)And (Store_Id<>Vendor_Id));
-
Sep 28th, 2000, 11:18 AM
#3
Frenzied Member
Your description of the problem is very confusing. You say that you want "to remove THE ROWS if the Store_Id and Customer_Id is the same but the Vendor_id is different".
There are no rows in your table where Store_Id = Customer_Id.
I think what you are trying to say is:
when there is more than 1 row with the same Store_Id and Customer_Id, delete any row with a Vendor_id that is different than the rest. So, in the following example, where rows 1, 2, 4 and 5 have Store_Id = 100 and Customer_Id = 0, you would want to delete rows 4 & 5 because Vendor_id <> 444. Is this correct?
1 | 100 | 444 | 0 | 100
2 | 100 | 444 | 0 | 200
3 | 100 | 555 | 2 | 50
4 | 100 | 666 | 0 | 125
5 | 100 | 888 | 0 | 21
-
Sep 28th, 2000, 01:35 PM
#4
Thread Starter
Addicted Member
yes exactly!!!!
thanks for the clarification!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|