How to limit the sql to reurn only 1 result
How to limit the sql to reurn only 1 result
(OP)
Hey,
My application give the user the ability to create a virtual view.
The user insert a query - "selcet product_id from product" and we show him the structre of this virtual view.
In order to get the column types i run this query than get the "ResultSetMetaData" ( by getMetaData() ) and finally get the column type from the ResultSetMetaData.
I dont need the full results for the query, so i want to limit the results for 1.
Does any one has an idea?
Thank you
My application give the user the ability to create a virtual view.
The user insert a query - "selcet product_id from product" and we show him the structre of this virtual view.
In order to get the column types i run this query than get the "ResultSetMetaData" ( by getMetaData() ) and finally get the column type from the ResultSetMetaData.
I dont need the full results for the query, so i want to limit the results for 1.
Does any one has an idea?
Thank you
RE: How to limit the sql to reurn only 1 result
I tried to have patience but it took to long!
-DW
RE: How to limit the sql to reurn only 1 result
John
RE: How to limit the sql to reurn only 1 result
currently i solved it by setting stmt.setMaxRows(1), but i read that it dosnt gurrenty better performance .
RE: How to limit the sql to reurn only 1 result
If you can tell us which database you are using then perhaps somebody will be able to help.
Geoff Franklin
www.alvechurchdata.co.uk
RE: How to limit the sql to reurn only 1 result
SELECT min (product_id) As [Product ID]
FROM product
WHERE condition
Important: You must set the where clause here to only retrieve data from the rows that you need, or you will get the smallest product ID in the table every time.
John
RE: How to limit the sql to reurn only 1 result
Questions about posting. See FAQ183-874