Using group by and having clause

前端 未结 5 1284
一生所求
一生所求 2020-12-07 11:59

Using the following schema:

Supplier (sid, name, status, city)
Part (pid, name, color, weight, city)
Project (jid, name, city)
Supplies (sid, pid, jid**, qua         


        
5条回答
  •  醉话见心
    2020-12-07 12:20

    1.Get supplier numbers and names for suppliers of parts supplied to at least two different projects.

     SELECT S.SID, S.NAME
     FROM SUPPLIES SP
     JOIN SUPPLIER S
     ON SP.SID = S.SID
     WHERE PID IN
     (SELECT PID FROM SUPPPLIES GROUP BY PID, JID HAVING COUNT(*) >= 2)
    

    I am not slear about your second question

提交回复
热议问题