truzilla
07-24-2008, 02:42 PM
Hi everyone! I am a complete SQL noob and I've been trying to train myself online but I can't even get this query to work. I'm not even sure if it's possible or if my question makes sense but I'll try and explain it and any help at all is appreciated!
Problem: I have a master table with many different levels (categories). I'm trying to write sql code that will ask the user for which level they want to see, then when the data is filtered by the query, the actual numbers can be added up by column to see the subtotals along with the final total.
To make this more clear I've included an example of what the table looks like and what I need the SQL to do:
1. Ask the user to enter which levels to filter by:
Level 1: Fruit
Level 2: Sweet
Level 3: * (all values)
2. After filtering using the SQL query Tim and Sonny's data should be left. Now i need to sum up their respective revenues and put them in a new row at the bottom.
I hope this makes sense!! Its a very simplified version but its essentially the same, i'm sure i'll figure out the logic if you can run it for this sample. Thanks!! :clap:
Problem: I have a master table with many different levels (categories). I'm trying to write sql code that will ask the user for which level they want to see, then when the data is filtered by the query, the actual numbers can be added up by column to see the subtotals along with the final total.
To make this more clear I've included an example of what the table looks like and what I need the SQL to do:
1. Ask the user to enter which levels to filter by:
Level 1: Fruit
Level 2: Sweet
Level 3: * (all values)
2. After filtering using the SQL query Tim and Sonny's data should be left. Now i need to sum up their respective revenues and put them in a new row at the bottom.
I hope this makes sense!! Its a very simplified version but its essentially the same, i'm sure i'll figure out the logic if you can run it for this sample. Thanks!! :clap: