mysql - Ambiguous column in field, but when I prefix, it says 'unknown' -


i have following query

select table1.user_id uid, table1.password pass, table1.libid user_id, table2.firstname, lockout.loginattempts, lockout.lastattempttime     from( select 'johndoe' user ) u      left join table1      on u.user = a.username      inner join table2     on table1.libid = table2.user_id      left join      (         select attemptedusername, loginattempts, lastattempttime         lockout          accounttype = 'public'      ) l      on u.user = l.attemptedusername 

originally, hadn't prefixed column names in field list table names, since both table1 , table have columns named user_id - mysql gave me 'ambiguous' error user_id.

after prefixing, i'm getting error

unknown column 'songbookdbpal_users.user_id' in 'field list'  

the column exists - there somewhere i'm tripping in syntax?

thanks time , help.

since gave table1 alias, have use in rest of query:

select a.user_id uid, a.password pass, a.libid user_id,          table2.firstname, lockout.loginattempts, lockout.lastattempttime from( select 'johndoe' user ) u  left join table1  on u.user = a.username  inner join table2 on a.libid = table2.user_id  left join  (     select attemptedusername, loginattempts, lastattempttime     lockout      accounttype = 'public'  ) l  on u.user = l.attemptedusername 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -