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 |
|
CXXXV
Starting Member
12 Posts |
Posted - 2010-01-08 : 13:27:31
|
| The following statement still returns multiple SESSION_ID recordsSELECT DISTINCT(SESSION_ID),ID FROM RES_SCHED WHERE SUB_PROG_ID = 10 It appears that SQL SERVER does not support this syntax. Is there some syntax that will make this work. I've searched for quite some time now. |
|
|
DP978
Constraint Violating Yak Guru
269 Posts |
Posted - 2010-01-08 : 13:29:44
|
| do you have multiple IDs per session ID?Have you tried CROSS APPLY yet?Edit: You should give an example of your table and expected vs Actual results, unless you put a max/MIN ID you will still have multiple lines. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-08 : 13:42:40
|
| you may be better off posting some data to give us an idea of how you want values to be retrieved. |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2010-01-08 : 16:00:41
|
| It will return multiple session_id records, probably because there are multiple combinations of :session_id and id. Which , in effect is the same as :SELECT SESSION_ID,IDFROM RES_SCHEDWHERE SUB_PROG_ID = 10GROUP BY SESSION_ID,IDJack Vamvas--------------------http://www.ITjobfeed.com |
 |
|
|
|
|
|