Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • holdingbe
    New Member
    • Jul 2007
    • 78

    Query

    Hi all,
    please find out the answer

    Find out the makers that sale PCs but not laptops.


    TABLE data:

    MAKER MODEL TYPE

    A 1298 Laptop
    C 1321 Laptop
    A 1752 Laptop
    B 1750 Laptop
    B 1121 PC
    A 1232 PC
    A 1233 PC
    E 1260 PC
    E 2112 PC
    E 2111 PC
    A 1276 Printer
    A 1401 Printer
    A 1408 Printer
    E 1434 Printer
    D 1433 Printer
    D 1288 Printer
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    kindly post the query that you have tried for this.

    Comment

    • chella
      New Member
      • Mar 2007
      • 51

      #3
      Hi,

      Try out this query...I hope this works for your case....

      select maker from t_chk where type = 'PC' and maker not in (select maker from t_chk where type <> 'PC')


      Regards,
      Chella

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by chella
        Hi,

        Try out this query...I hope this works for your case....

        select maker from t_chk where type = 'PC' and maker not in (select maker from t_chk where type <> 'PC')


        Regards,
        Chella
        Your Query will not work for MAKER 'E' who makes PC and PRINTER.

        Try out below Query:
        [CODE=oracle]
        select maker from t_chk where type = 'PC' and maker not in (select maker from t_chk where type = 'Laptop')
        [/CODE]

        Comment

        • Saii
          Recognized Expert New Member
          • Apr 2007
          • 145

          #5
          Try using Set operators. They are more performance sensitive.

          Comment

          Working...