473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with multiple rows returned by query

My query is this

Expand|Select|Wrap|Line Numbers
  1. 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......
Oct 13 '10 #1
1 1680
Use "LIMIT 1" at the end of the statement.
Nov 4 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jerry | last post by:
I have a need to concatenate all Descriptions from a select statement SELECT t_ReviewSection.PeerRevSectionDescription FROM t_ReviewSection WHERE t_ReviewSection.PeerRevID = @lngRevID...
7
by: Egor Shipovalov | last post by:
I'm implementing paging through search results using cursors. Is there a better way to know total number of rows under a cursor than running a separate COUNT(*) query? I think PostgreSQL is bound...
1
by: BF | last post by:
Hello, I am trying to find out if there is a way to limit the number of rows returned when a cursor is opened. I am using DB2 version 7 on z/OS. The SELECT statement in my DECLARE CURSOR...
4
by: fip | last post by:
Hi, On DB2 7.1.2 on MVS OS 390, when I tried to do an insert with multiple row contents in the values clause: insert into table11 values('aaaa', 'fa'), ('bbbb', 'fb') I got the error: ...
4
by: don.fleming | last post by:
Hi folks: Am doing a VBA SQL Select stmt with multiple rows found and not getting RecordCount > 1. I've verified there are multiple rows found by copying my SQL stmt from Debug window and pasting...
4
by: Chris Tremblay | last post by:
I am trying to figure out how to go about retrieving the number of results returned from my queries in SQL server from VB.NET without using a the Select Count(*) query. The method that I was using...
5
by: Antanas | last post by:
Is it possible to combine multiple rows returned from select statement into one row? SELECT NAME FROM TABLE1; I want all names to be combined into one row seperated by commas.
2
TheServant
by: TheServant | last post by:
I know that there was a post on this a little while back but I can't find it. $raw_data = mysql_query(" SELECT * FROM mytable ") or die(mysql_error()); $data =...
2
by: yuva17raj | last post by:
hi i am using the select query with group by, so that i am getting records with more than one column so that i need to calculate the number of rows returned by the query for example with my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.