Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tough problem for me, ez to you??? Help!
Message
General information
Forum:
Microsoft SQL Server
Category:
Security
Miscellaneous
Thread ID:
00675732
Message ID:
00675739
Views:
10
>I am attempting to display a table within an .asp page from their database. What my client wants to see:
>
>___________cat1 | cat2 | cat3 | cat4 |
>group1______5__|___2__|___4__|___4___|
>group2______4__|___2__|___0__|___0___|
>group3______1__|___0__|___2__|___2___|
>
>My plan was to use a query for each cat to come up with the 4 different columns, like this:
>
>SELECT Count(cat) as Expr1, cat, group
>FROM dbo.Open_DurationsTable1
>WHERE cat = 'cat2' Group By group, cat
>
>This works fine except for that fact that certain combinaitons don't exist, therefore there is no data returned, for example, when the query is ran for cat1, each group is returned with a corresponding count. If ran for cat2, only group1 and group2 are returned, nothing is returned for group3 as it doesn't exist. Both the catagory and group are in the same table, and the goups and catagories each have their own table with no other info in them (did that to see if query 2 tables at once might help). My question is, is there a way to construct a query that would display the count for each group, even if there isn't a result for each group. Since this is written for use in an .asp page, is thre maybe a way to have some .asp code read the query results and fill in the gaps? Confusing enough?

You can join the 4 result cursors using FULL OUTER JOIN and after that use NVL() function to REPLACE missing values
Venelina Jordanova

Outsourcing IT Services Ltd.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform