Problem with multiple rows returned by query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nipun Valoor

    #1

    Problem with multiple rows returned by query

    My query is this

    Code:
    select (select COUNT (*) from S_PROD_REL where PAR_PROD_ID IN (select ROW_ID from s_prod_int where S_PROD_REL.PAR_PROD_ID = S_PROD_INT.ROW_ID) AND PROD_ID IN(select ROW_ID from s_prod_int where S_PROD_REL.PROD_ID = S_PROD_INT.ROW_ID)) as RowsSatisfyingValidation,(select COUNT (*) from S_PROD_REL) AS TotalNumOfRows From S_PROD_INT,S_PROD_REL;
    it is producing the expected result,but its being repeatedly printed m*n times...how can i get just one row as result.... tried using TOP..but nt working...

    pls help me......
    Last edited by MMcCarthy; Oct 13 '10, 07:29 AM.
  • Ian Smith
    New Member
    • Nov 2010
    • 6

    #2
    Use "LIMIT 1" at the end of the statement.

    Comment

    Working...