yep, I was thinking in either a sub select or an inner join, but I a just confusing myself further....the more it reaches 5 o'clock the more I want to leave it till the morrow :-)
-----Original Message----- From: David Phipps [mailto:[EMAIL PROTECTED]] Sent: 03 February 2003 15:58 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] SQL Fuzz You could do this: SELECT tbl1.FileId, tbl1.Name, tbl1.SharerID, tbl2.Name AS SharerName FROM tbl AS tbl1 INNER JOIN tbl AS tbl2 ON(tbl1.fileId=tbl2.shareId) I haven't checked if this works but it might give you you an idea...? HTH Dave At 15:32 03/02/2003 +0000, you wrote: >You can join a table to itself... > >SELECT tbl_query.Name, tbl_query.FileID, tbl_query.SharerID, myTable.Name >FROM ( > SELECT Name, FileID, SharerID > FROM myTable) as tbl_query > INNER JOIN myTable ON tbl_query.SharerID = myTable.SharerID > > > yes that would make sense, but there is no other table.... > > there is only one table. > > > > -----Original Message----- > > From: Paul Johnston [mailto:[EMAIL PROTECTED]] > > Sent: 03 February 2003 15:25 > > To: [EMAIL PROTECTED] > > Subject: RE: [ cf-dev ] SQL Fuzz > > > > > > > Here's one I cant seem to get at the mo.. > > > > > > I have a result (SQL Server) which gets me back data all fine > > > and dandy... it returns the following [pseudo] fields... > > > > > > Name > > > FileID > > > SharerID > > > > > > A sample set of data could be : > > > > > > Name FileID SharerID > > > ------- ------- ------------ > > > Foo 1 2 > > > Boo 2 4 > > > Goo 3 1 > > > Choo 4 3 > > > > > > What I need to do is query the table above BUT get the 'Name' > > > which corresponds to the SharerID itself..in one query..... > > > > SELECT tbl.Name, tbl.FileID, tbl.SharerID, otherTbl.Name > > FROM ( > > SELECT Name, FileID, SharerID > > FROM MyTable) as tbl > > INNER JOIN Othertbl ON tbl.SharerID = Othertbl.SharerID > > > > Make Sense? > > > > Paul > > > > > > > > > > -- > > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] For human help, e-mail: > > [EMAIL PROTECTED] > > > > -- > > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] For human help, e-mail: > > [EMAIL PROTECTED] > > > > > > >-- >** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
