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 |
|
Tim F
Starting Member
35 Posts |
Posted - 2005-04-06 : 11:45:52
|
| I'm trying to put a select into the brackets and use the results set to join to. Is this possible. I am aware of the IN clause but if I can do it like this I'd prefer it). Speed is not an issue here.Thanks, Timselect * fromsims.att_mark_normalised markninner join (select distinct m1.session_start, m1.person_id from sims.att_mark_normalised m1 inner join sims.att_mark_normalised m2 on m1.person_id = m2.person_id and m1.session_start = m2.session_start and m1.att_week_id <> m2.att_week_id -- where weeks are different and m1.mark <> m2.mark -- and marks are different ) allmarks on allmarks.person_id = markn.person_id |
|
|
PW
Yak Posting Veteran
95 Posts |
Posted - 2005-04-06 : 12:05:14
|
| >>Is this possible. Yes. It's called a "Derived Table".Are you getting an error with the above SQL ? |
 |
|
|
Tim F
Starting Member
35 Posts |
Posted - 2005-04-07 : 04:26:12
|
| Yep, the sub select works on it own but not inside this select. Must be doing something stupid! |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-04-07 : 05:02:09
|
| is the error ambiguous column name? try enumerating the fields instead of *--------------------keeping it simple... |
 |
|
|
|
|
|