i've got a particularly evil problem... i've got to join to the same table multiple times in a query. thus i'm using the same table given three (for example) diferrent aliases and using the aliases to join them.
now, i've done this before when joining a table to itself and it worked, but now it barfs saying;
ERROR 1054: Unknown column 'wd_a' in 'where clause'
i'm running
"mysql Ver 10.12 Distrib 3.23.25-beta, for pc-linux-gnu (i686)"
this is the sql; any help greatly appreciated.
(to explain: there is a many-to-many between ndx_resource and ndx_words, with ndx_links being the link table)
mysql> select
-> locator
->
-> from
-> ndx_resource as rs,
-> ndx_links as ln_a,
-> ndx_links as ln_b,
-> ndx_links as ln_c,
-> ndx_words as wd_a,
-> ndx_words as wd_b,
-> ndx_words as wd_c
->
-> where
-> and rs.resid=ln_a.resid
-> and ln_a.wordid=wd_a.wordid
-> and wd_a="hollywood"
->
-> and rs.resid=ln_b.resid
-> and ln_b.wordid=wd_b.wordid
-> and wd_b="jail"
->
-> and rs.resid=ln_c.resid
-> and ln_c.wordid=wd_c.wordid
-> and wd_c="theft";
now, i've done this before when joining a table to itself and it worked, but now it barfs saying;
ERROR 1054: Unknown column 'wd_a' in 'where clause'
i'm running
"mysql Ver 10.12 Distrib 3.23.25-beta, for pc-linux-gnu (i686)"
this is the sql; any help greatly appreciated.
(to explain: there is a many-to-many between ndx_resource and ndx_words, with ndx_links being the link table)
mysql> select
-> locator
->
-> from
-> ndx_resource as rs,
-> ndx_links as ln_a,
-> ndx_links as ln_b,
-> ndx_links as ln_c,
-> ndx_words as wd_a,
-> ndx_words as wd_b,
-> ndx_words as wd_c
->
-> where
-> and rs.resid=ln_a.resid
-> and ln_a.wordid=wd_a.wordid
-> and wd_a="hollywood"
->
-> and rs.resid=ln_b.resid
-> and ln_b.wordid=wd_b.wordid
-> and wd_b="jail"
->
-> and rs.resid=ln_c.resid
-> and ln_c.wordid=wd_c.wordid
-> and wd_c="theft";