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 |
|
David Wadsworth
Starting Member
17 Posts |
Posted - 2011-03-21 : 07:56:31
|
| Hello,I think I am having a grey moment and have forgotten (or never knew) how to do something basic.Example tableUIN Name AssociateWith 1 AAA NULL 2 BBB NULL 3 CCC 1I want to return all records soSELECT UIN,Name,AssociateWith FROM yadaReturns 1 AAA NULL 2 BBB NULL 3 CCC 1BUT I want the third lin,e third value (currently 1) to be 'AAA' which is the name not the UIN that is AssociateWith column.I have looked back through all of the code I have written but cannot find out how to do this?If you tell me, I promised to go "AAAAAAARRRRGGGHHHHH" and remember instantly.Regards |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-03-21 : 08:02:11
|
| SELECT y.UIN,y.Name,t.NameFROM yada yLEFT JOIN table t on y.AssociatedWith = t.UINJimEveryday I learn something that somebody else already knew |
 |
|
|
David Wadsworth
Starting Member
17 Posts |
Posted - 2011-03-21 : 10:45:54
|
| Dear jimf,OMG (without Peaches Geldof) I did have a moment and I didnt get it until I read your reply.I am gonna give up coding and do gardening.Thanks mate.David (blushing) |
 |
|
|
|
|
|