sql - MySQL Error #1142 with INNER JOIN -
select * `pp` inner join `cm_master`.`locationguid` on `pp`.`addr` = `cm_master`.`address1` , `pp`.`zip` = left(`cm_master`.`postalcode`,5);
i trying return columns in pp table matching locationguid record cm_master table when street address , zip matches between 2 tables. above code returns error:
#1142 - select command denied user 'ameridw5'@'localhost' table 'locationguid'
i running query in phpmyadmin. can point me in direction work?
edit: cm_master table has address1, zip , locationguid columns. pp table has addr , zip columns. if pp.addr = cm_master.address1 , pp.zp = cm_master.zip return record in query cm_master.locationguid joined it. possible?
your syntax wrong. need place left
around table_name.column_name
instead of splitting table_name , column_name.
so change
cm_master.left(postalcode,5)
to
left(cm_master.postalcode,5)
the full query be:
select * `pp` inner join `cm_master` on `pp`.`addr` = `cm_master`.`address1` , `pp`.`zip` = left(`cm_master`.`postalcode`,5) ;
edit, not clear table structure need locationguid
, possibly need add column well:
select * `pp` inner join `cm_master` on `pp`.`locationguid` = `cm_master`.`locationguid` , `pp`.`addr` = `cm_master`.`address1` , `pp`.`zip` = left(`cm_master`.`postalcode`,5) ;
Comments
Post a Comment