i have an sql statement like this:
SELECT distinct store, dept, sku
FROM some_table
WHERE some_condition
i simply want to modify it to give me the count, i tried this, but it doesn't work:
SELECT count (distinct store, dept, sku)
FROM some_table
WHERE some_condition
what am i doing wrong? thank you very much for your help.This is a pure guess, but do you want something like:SELECT Count(*), store, dept, sku
FROM some_table
WHERE 1 = 1 -- or some other condition of your choosing
GROUP BY store, dept, sku-PatP|||thanks for the help, yeah i think that will work, but i ended up doing something like this:
SELECT count(1)
FROM ( SELECT distinct store, dept, sku
FROM some_table
WHERE some_condition
)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment