Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mahimam_2004
Starting Member
40 Posts |
Posted - 2007-04-14 : 13:23:57
|
Hi,I have the table:exexposureRoute: with columnscaseId, exRouteID 200 70 300 71200 72200 73 .. ..Route table:exRoteID name70 a71 b72 c73 d74 eand so on Outcome table OutomceID name1 Outcome12 Outcome2.. In my result set i want like this: Routes Outcome1 Outcome2 Outcome3abcdefgha/ca/c/bb/c/ea/ea/ba/da/b/da/b/ea/d/ea/b/d/eb/eb/db/d/ed/e I need to get only those combinations not all the Possible combinations.in the above a/b means i want the casecount for which cases both a and b exists for each outcome type.For one case there mey be possibilty of more than one route.How to write the query to get those routes combinations case counts.Thanks in advance |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-14 : 14:42:25
|
You need a CROSSTAB query.Peter LarssonHelsingborg, Sweden |
|
|
mahimam_2004
Starting Member
40 Posts |
Posted - 2007-04-14 : 18:53:07
|
Hi Peso,Can you give me tha example how to write Crosstab query.Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-15 : 04:57:25
|
http://www.sqlteam.com/sqlsearch.asp?cx=011171816663894899992%3A7atqeqkjkui&q=crosstab+pivot&cof=FORID%3A9#1145Peter LarssonHelsingborg, Sweden |
|
|
|
|
|