MYSQL: How to limit inner join?

Posted by Sergii Rechmp on Stack Overflow See other posts from Stack Overflow or by Sergii Rechmp
Published on 2012-09-07T09:30:01Z Indexed on 2012/09/07 9:37 UTC
Read the original article Hit count: 202

Filed under:
|
|
|
|

I need some help with my query. I have 2 tables:

all: art|serie
sootv: name|art|foo

I need to get result like name|serie. My query is:

SELECT t2.NAME,
    t1.serie
FROM (
    SELECT *
    FROM `all`
    WHERE `serie` LIKE '$serie'
    ) t1
INNER JOIN sootv t2
    ON t1.art = t2.art;

it works, but sootv table contains data like

name|art|foo
abc | 1 | 5
abc | 1 | 6

i get 2 same results. Its not what i need. Help me please - how i can get only one result: abc|1

Thanks.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql