![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi All : CREATE TABLE TABLEA(Person Varchar(20), Country Varchar(20), Subject Varchar(20), Type Char(1)) INSERT INTO TABLEA VALUES ('Einstein', 'Germany', 'Physics', 'P') INSERT INTO TABLEA VALUES ('Kant', 'Germany', 'Philosophy', 'Q') INSERT INTO TABLEA VALUES ('Kafka', 'Germany', 'Writer' , 'W') INSERT INTO TABLEA VALUES ('Aristotle', 'Greece', 'Philosophy', 'Q') INSERT INTO TABLEA VALUES ('Archimedes', 'Greece', 'Physics', 'P') INSERT INTO TABLEA VALUES ('Homer', 'Greece', 'Writer' , 'W') SELECT * FROM TABLEA I am on SQL 2000. I need an output where i have to have a resultset grouped on Type, but the results in one row. In the resultset I need TypeP Person Type P Country, Type Q Person, Type Q Country, Type W Person Type W Country --------------------------------------------------------------------------------------------------------------------- Einstein:Archimedes Germany:Greece Kant:Aristotle Germany:Greece Kafka:Homer Germany:Greece ************************************************** ************* I have written a puesdo-cursor code to do the same, but if there is a way to do as a set operation, that would be great Please select as a whole and past in query analyser as the resultset is all overlaid when i paste in this box. Thank you RS |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thank you much. This gives me 2 values, min and max. but, I will have a total of 4 persons on philosophy and it could be either 0 or 1 or 2 or 3 or 4 persons in philisophy. Is it possible to do a set operation for that ? |
![]() |
| Thread Tools | |
| Display Modes | |
| |