sql - mysql 2 join error on multiple WHERE clause -
i trying call specific information sql table using following statement
select `prop_street`, `prop_price`, `prop_status`, `agt_fname`, `agt_lname` `property`, `agent` property.prop_agent = agent.agt_fname && property.prop_status = ("sold" , "available sale", "under contract");
as can see, trying call listed sold
, available sale
, under contract
. while try this, getting error operand should contain 1 coulmn
happens when trying call more 1 prop_status
this proper syntax you're trying do:
select prop_street, prop_price, prop_status, agt_fname, agt_lname property p join agent on p.prop_agent = a.agt_fname p.prop_status in ('sold', 'available sale', 'under contract')
some notes:
join conditions belong in join clause, not clause. although there no functional difference, practice.
&& mean "and" in other languages, not sql. have use "and"
use single quotes literals ('), not double quotes (")
use in, not =, when specifying more 1 literal.
Comments
Post a Comment