sql - mysql 2 table join unknown column -
how can display joined table while selecting specific column of information?
select `prop_street`, `prop_price`, `prop_status`, `agt_fname`, `agt_lname`, `prop_status` `property`, `agent` property.prop_agent = agent.agt_fname && property.prop_status = sold;
as can see above, trying display rows prop_status = sold
error saying error 1054 unknown column sold in clause
you need add single quotes sold
value. should learn use modern join
syntax. don't need backticks around every identifier. and, using table aliases makes query both easier write , read:
select prop_street, prop_price, prop_status, agt_fname, agt_lname, prop_status property p join agent on p.prop_agent = a.agt_fname p.prop_status = 'sold';
(i use table aliases from
clause, don't know go.)
finally, doubt need prop_status
twice in select
clause.
Comments
Post a Comment