MYSQL Select with joins and where -


i got 2 tables:

device

deviceid  devicename  categoryid 

category

categoryid  categoryname 

it seems stupid solve problem; need select query brings me result:

resulttable

deviceid  categoryid  categoryname 

i tried this, no success:

select deviceid     , categoryid     , categoryname category left join device on (category.categoryid = device.categoryid) deviceid = '1'; 

in short, need table shows me categorie's id , name, of category certain device in.

hope me, since english not good.

your query should this:

select d.deviceid,        c.categoryid,        c.categoryname device d inner join category c on c.categoryid = d.categoryid d.deviceid = 1 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -