single-row subquery returns more than one row

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xqiu008
    New Member
    • Oct 2007
    • 1

    single-row subquery returns more than one row

    single-row subquery returns more than one row


    select SalesRep.SalesR epNumber, SalesRep.last, SalesRep.First, CreditLimit, Customer.SalesR epNumber
    From SalesRep, Customer
    Where creditLimit = ( Select creditLimit
    From Customer
    Where creditLimit = 2000);
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by xqiu008
    single-row subquery returns more than one row


    select SalesRep.SalesR epNumber, SalesRep.last, SalesRep.First, CreditLimit, Customer.SalesR epNumber
    From SalesRep, Customer
    Where creditLimit = ( Select creditLimit
    From Customer
    Where creditLimit = 2000);
    There are many entries in your table where creditLimit is 2000.
    [CODE=oracle]Select creditLimit From Customer Where creditLimit = 2000[/CODE] returned more than one value so your outer select will fail because it is expecting only one value with its = comparator there.
    Explain what you want to achive so that we may know which query you want to use.

    Comment

    • Saii
      Recognized Expert New Member
      • Apr 2007
      • 145

      #3
      Is this helpful?

      select SalesRep.SalesR epNumber, SalesRep.last, SalesRep.First, CreditLimit, Customer.SalesR epNumber
      From SalesRep, Customer
      Where creditLimit in ( Select creditLimit
      From Customer
      Where creditLimit = 2000);

      Comment

      Working...