mrbunyrabit
mrbunyrabit

Reputation: 509

whats wrong with my sql statement?

I know how a where clause works, but in this case, it doesnt seem to work.. might be because im getting confused with all the left joins and renaming and what have you.

So this statement works fine without the where, but when i add the where clause, it says that the column in the where clause is unknown.... Does any one know whats wrong?

select t1.name AS DistroName,t2.name AS OriginName, t3.name AS DesktopName, t3.name AS desktoptest , t2.country, t1.status, t2.description , t5.name as oldtest, t6.name as multitest, t4.name as begintest
from alldistros t1 
LEFT join origin t2 on t1.name=t2.name
LEFT join desktop t3 on t2.name=t3.name
LEFT join beginnerdistributions t4 on t3.name=t4.name
LEFT join oldcomputers t5 on t4.name=t5.name
LEFT join multimedia t6 on t5.name=t6.name
WHERE DistroName = 'Absolute LInux'

Thank you Ruan

Upvotes: 0

Views: 60

Answers (3)

Joseph Le Brech
Joseph Le Brech

Reputation: 6653

You probably have an ambiguious DistroName for more than one table, try doing where t1.DistroName = "" or t1.DistroName ...

Upvotes: 0

Nighil
Nighil

Reputation: 4129

use t1.name in where clause

select t1.name AS DistroName,t2.name AS OriginName, t3.name AS DesktopName, t3.name AS desktoptest , t2.country, t1.status, t2.description , t5.name as oldtest, t6.name as multitest, t4.name as begintest
from alldistros t1 
LEFT join origin t2 on t1.name=t2.name
LEFT join desktop t3 on t2.name=t3.name
LEFT join beginnerdistributions t4 on t3.name=t4.name
LEFT join oldcomputers t5 on t4.name=t5.name
LEFT join multimedia t6 on t5.name=t6.name
WHERE t1.name= 'Absolute LInux'

Upvotes: 0

gmadd
gmadd

Reputation: 1156

Try changing

WHERE DistroName = 'Absolute LInux'

to

WHERE t1.name = 'Absolute LInux'

Upvotes: 5

Related Questions