名宏 鄭
名宏 鄭

Reputation: 115

Mysql Error Message : 1242 Subquery returns more than 1 row

I have two table in database and I have problem

when I commend this in mysql it's can working

    select 
    (select deptno.`FName` 
        from deptno where deptno.`FID` = person.`Unit1No`) as  dept
            from person,leavemonth WHERE person.PsnNo = leavemonth.PsnNo

but when I choice the condition to this, it's give me a message like the problem title

        select 
        (SELECT leavemonth.`H08` FROM leavemonth where leavemonth.`PsnNo` = person.`PsnNo` )
            as H08
    from person,leavemonth WHERE person.PsnNo = leavemonth.PsnNo

I try many way and try to fine answer,but always fail,

have anyone can teach me and tell me how to fix it ?

Upvotes: 0

Views: 244

Answers (1)

Ankit Agrawal
Ankit Agrawal

Reputation: 2454

it will work for you

select l.H08 as H08
from person p
inner join leavemonth l on p.PsnNo = l.PsnNo   

Upvotes: 1

Related Questions