Awkward SELECT statement question
I've got an MSAccess database with 2 tables in, with the following columns:
Table1
UID (number)
Col1 (number)
Col2 (number)
Table2
ID (number)
Desc (text)
Each entry in col1 and col2, equates to table 2's ID field. & what I'd like to return/make in an SQL command is the following
"Grab everything from the Table1 table,
Col1 ordered alphabetically on it's corresponding description column in table2,
Col2 ordered alphabetically on it's corresponding description column in table2"
How can I do this please?????!??!?!? :afrog:
Re: Awkward SELECT statement question
Maybe something like:
Code:
Select t1.[UID]
, t1.[Col1]
, t2a.[Desc]
, t1.[Col2]
, t2b.[Desc]
From Table1 t1 Inner Join Table2 t2a On t1.[Col1] = t2a.[ID]
Inner Join Table2 t2b On t1.[Col2] = t2b.[ID]
Order By t2a.[Desc], t2b.[Desc]
Maybe?
Re: Awkward SELECT statement question
Cheers Chris!
As this was access, I needed to put brackets around this so it worked, but that did the trick thanks!!!! :bigyello:
Code:
From (Table1 t1 Inner Join Table2 t2a On t1.[Col1] = t2a.[ID])
Inner Join Table2 t2b On t1.[Col2] = t2b.[ID]