August 29, 2005 at 5:44 pm
Dear all,
I am building a query from just a single table and would really appreciate any help. Thanks in advance.
Table A
-------
ID#Value#Group
---------------
1#Value1#Grp1
2#Value2#Grp2
INTO a temp table
Temp table
-----------
ID#Value
--------
1#Value1-Grp1
2#Value1-Grp2
3#Value2-Grp1
4#Value2-Grp2
August 29, 2005 at 7:05 pm
Can you explain as what result set you are looking. I assume you need some kind of cross join.
Amit Lohia
August 29, 2005 at 7:41 pm
Thanks for the reply. Looking at my example again, I thought I had a poor one so I will do another.
Table1
ID#TypeName#Type
-------------------
1#Maths#Subject
2#Science#Subject
3#Percent10#Percentile
4#Percent50#Percentile
Using Table 1, I would need to write a script to write into a temp table (#temp) which is the result set.
#temp
ID#Name
--------
1#Maths-Percent10
2#Maths-Percent50
3#Science-Percent10
4#Science-Percent50
The type "name" would be a concatenation between the combination of subjects and percentiles.
Thanks in advance.
August 29, 2005 at 7:54 pm
SELECT * FROM Table1 A
JOIN Table1 B ON A.Type<>B.Type
AND A.Type = 'Subject'
SELECT * FROM Table1 A
JOIN Table1 B ON B.Type='Percentile'
AND A.Type = 'Subject'
You can do in other ways also
Amit Lohia
August 29, 2005 at 8:13 pm
Thanks so much!
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy