Hi,
I have a query that I know is probably easy to write, but I'm just missing it for some reason.
Here's the basic query:
select id, sku from myTable
into #temp
where sku = 'abc'
or sku = 'def'
or sku = 'ghi'
or sku in ('yy', 'zz')
group by profile_id, sku
order by profile_id, sku
Basically I eventually want to get every "id" who has sku 'abc' + 'def' + 'ghi' + 'yy' OR 'zz'.
So, if "id" 1 has sku's 'abc' + 'def' + 'ghi' + 'yy' OR 'abc' + 'def' + 'ghi' + 'zz', that's good.
But if it has sku's 'abc' + 'def' + 'yy' + 'zz' I don't want this id selected.
The above query is just an attempt to narrow my working data set. So if anyone has any suggestions as to do this in one query, or using the results of the above query, I'd greatly appreciate it!
Thanks
I have a query that I know is probably easy to write, but I'm just missing it for some reason.
Here's the basic query:
select id, sku from myTable
into #temp
where sku = 'abc'
or sku = 'def'
or sku = 'ghi'
or sku in ('yy', 'zz')
group by profile_id, sku
order by profile_id, sku
Basically I eventually want to get every "id" who has sku 'abc' + 'def' + 'ghi' + 'yy' OR 'zz'.
So, if "id" 1 has sku's 'abc' + 'def' + 'ghi' + 'yy' OR 'abc' + 'def' + 'ghi' + 'zz', that's good.
But if it has sku's 'abc' + 'def' + 'yy' + 'zz' I don't want this id selected.
The above query is just an attempt to narrow my working data set. So if anyone has any suggestions as to do this in one query, or using the results of the above query, I'd greatly appreciate it!
Thanks