| Author |
Topic |
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-05-03 : 05:21:30
|
| Hi all, My result set is like this , here i want a free column after eachpos grp ... how i can do Position_ID Position PosGrp1 Bachelors Student 12 Master Student 13 Medical Student 14 Ph.D. Student 15 M.D. Student 16 Post Doctoral Researcher 27 Tenure Track 28 Assistant Professor 29 Tenured Professor 210 Principal Investigator 211 Lab Head 212 Laboratory Director 236 Senior Registrar 338 Senior Resident 326 Attending Physician 327 Family Physician 328 House Officer 323 School Teacher 424 Educator 425 Consultant 434 Nurse 4My code is like thisSELECT Position_ID ,Position,posgrp FROM dbo.FIS_Position WITH(NOLOCK) WHERE Status='A' AND Lang_ID = 1 ORDER BY posgrpRegards,Divya |
|
|
karthik_padbanaban
Constraint Violating Yak Guru
263 Posts |
Posted - 2010-05-03 : 05:27:22
|
| what do you mean by Free column..?Karthikhttp://karthik4identity.blogspot.com/ |
 |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-05-03 : 05:35:51
|
quote: Originally posted by karthik_padbanaban what do you mean by Free column..?Karthikhttp://karthik4identity.blogspot.com/
soory a row should be left free like thatRegards,Divya |
 |
|
|
karthik_padbanaban
Constraint Violating Yak Guru
263 Posts |
Posted - 2010-05-03 : 05:54:26
|
| May be this could help you to some extent.SELECT a.posgrp,a.Position_ID ,a.PositionFROM dbo.FIS_Position a WITH(NOLOCK)WHERE Status='A' AND Lang_ID = 1 union allselect distinct(b.posgrp),'','' from FIS_Position b WITH(NOLOCK)ORDER BY a.posgrpKarthikhttp://karthik4identity.blogspot.com/ |
 |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-05-03 : 06:26:03
|
quote: Originally posted by karthik_padbanaban May be this could help you to some extent.SELECT a.posgrp,a.Position_ID ,a.PositionFROM dbo.FIS_Position a WITH(NOLOCK)WHERE Status='A' AND Lang_ID = 1 union allselect distinct(b.posgrp),'','' from FIS_Position b WITH(NOLOCK)ORDER BY a.posgrpKarthikhi karthik, Thank for your help, but this query wnt satisfy my requirement i am getting output like this when i use this query 1 1 Bachelors Student 1 5 M.D. Student1 0 2 0 2 33 Fellow2 22 University Teacher2 6 Post Doctoral Researcher3 26 Attending Physician3 27 Family Physician3 38 Senior Resident3 0 4 0 4 34 Nurse4 35 Pharmacisti want the output like this1 1 Bachelors Student 1 5 M.D. Student1 02 33 Fellow2 22 University Teacher2 6 Post Doctoral Researcher 2 03 26 Attending Physician3 27 Family Physician3 38 Senior Resident3 04 34 Nurse4 35 Pharmacist4 0 http://karthik4identity.blogspot.com/
Regards,Divya |
 |
|
|
karthik_padbanaban
Constraint Violating Yak Guru
263 Posts |
Posted - 2010-05-03 : 07:20:47
|
| SELECT a.posgrp,a.Position_ID ,a.PositionFROM dbo.FIS_Position a WITH(NOLOCK)WHERE Status='A' AND Lang_ID = 1 union allselect distinct(b.posgrp),'','' from FIS_Position b WITH(NOLOCK)ORDER BY a.posgrp,a.Position_ID descKarthikhttp://karthik4identity.blogspot.com/ |
 |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-05-03 : 07:41:21
|
quote: Originally posted by karthik_padbanaban SELECT a.posgrp,a.Position_ID ,a.PositionFROM dbo.FIS_Position a WITH(NOLOCK)WHERE Status='A' AND Lang_ID = 1 union allselect distinct(b.posgrp),'','' from FIS_Position b WITH(NOLOCK)ORDER BY a.posgrp,a.Position_ID descKarthikhttp://karthik4identity.blogspot.com/
Thank you karthik it workedRegards,Divya |
 |
|
|
karthik_padbanaban
Constraint Violating Yak Guru
263 Posts |
Posted - 2010-05-03 : 08:00:24
|
Welcome. Karthikhttp://karthik4identity.blogspot.com/ |
 |
|
|
|