June 17, 2009 at 9:22 am
bump for help.
June 17, 2009 at 9:28 am
could you supply some the definition of your table and some sample data with the expect output.
It's pretty hard to write a query for a desired output if you dont' know what data you working with.
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
June 17, 2009 at 9:32 am
You'll also need a column in your query for the table or something else to group by.
For your results, not sure what the values mean.
June 17, 2009 at 9:55 am
Chris hit it perfectly.
June 17, 2009 at 10:01 am
try this:
SELECT
Category,
COUNT(*)
FROM
(SELECT
CASE WHEN salary between 0 and 10000 then 'range = 20000 and salary = 30000 and salary = 40000 and salary = 50000 and salary = 60000 and salary = 70000 and salary = 80000 and salary = 90000 and salary = 100000 and salary < 110000 then 'range $100k-$110k'
ELSE 'OTHER'
END as Category
FROM employee) n
GROUP BY Category
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
June 17, 2009 at 10:10 am
perfection!!!
Thanks
June 17, 2009 at 11:39 am
Dabears2k, Also go through the first link in Christopher's signature. This will help you to get correct answer to the point in future :-). You posted desired output much later than it should have been. i concentrated more on the syntax than the output:hehe:.
June 17, 2009 at 12:40 pm
needed to do a select within a select with a join
June 17, 2009 at 2:37 pm
making headway
June 17, 2009 at 3:01 pm
finished
Viewing 10 posts - 16 through 24 (of 24 total)
You must be logged in to reply to this topic. Login to reply