|
Posted by Andrew Tatum on 10/30/06 20:00
Alright, so I have this problem. I want to make it easy for me and
others to be able to run a query and easily choose whether we want
Merchants or NonMerchants. Previously, we would have to comment out
bits of code and would leave things messy (it would also leave room for
error). So, I'm thought DECLARE and SET would work. Wrong.
This is what I have....
DECLARE @Merchant VARCHAR
SET @Merchant = (Select CONVERT(VARCHAR, Id) + ','
FROM AdminAdvertiserTypesDDL
WHERE Id IN (1,3,4,5)
) // Includes Active, Out of Business, Cease to do business, Inactive
I've also tried...
SET @Merchant = '1,3,4,5'
Then, in the query itself I try:
WHERE AdminAdvertiserTypesDDL.Id = @Merchant
or
WHERE AdminAdvertiserTypesDDL.Id IN @Merchant
or
WHERE AdminAdvertiserTypesDDL.Id IN (@Merchant)
or
WHERE AdminAdvertiserTypesDDL.Id LIKE @Merchant
Either way, it will ONLY show me the merchants whose Id is 1. When I
make the query:
WHERE AdminAdvertiserTypesDDL.Id IN (1,3,4,5)
I finally get the desired results.
Any ideas or tips?
Thank you so much!
Navigation:
[Reply to this message]
|