Re: Counting rows in a resultset

2002-08-29 Thread Ilya A. Kriveshko
If running two queries is not out of the question for some principal reasons, I'd suggest the following: Run a query with LIMIT 1, 1. That query will return results ONLY if there are two or more rows that match. Then run your second query both inside the esql:no-results/esql:no-results and

Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen
Hi, How can I count the rows in my resultset? I'm using esql, but esql:row-count/ doesn't seem to be implemented yet. SQL COUNT(*) doesn't work in this case either. Can I do this with XSP? Thanks, -Tuomo - Please check that

Re: Counting rows in a resultset

2002-08-28 Thread Christian Haul
On 28.Aug.2002 -- 10:07 AM, Tuomo Lesonen wrote: Hi, How can I count the rows in my resultset? I'm using esql, but esql:row-count/ doesn't seem to be implemented yet. SQL COUNT(*) doesn't work in this case either. Can I do this with XSP? Yes, have a new var declared before the

Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen
On Wed, 28 Aug 2002, Christian Haul wrote: On 28.Aug.2002 -- 10:07 AM, Tuomo Lesonen wrote: Hi, How can I count the rows in my resultset? I'm using esql, but esql:row-count/ doesn't seem to be implemented yet. SQL COUNT(*) doesn't work in this case either. Can I do this with XSP?

Re: Counting rows in a resultset

2002-08-28 Thread Christian Haul
On 28.Aug.2002 -- 10:48 AM, Tuomo Lesonen wrote: On Wed, 28 Aug 2002, Christian Haul wrote: On 28.Aug.2002 -- 10:07 AM, Tuomo Lesonen wrote: Hi, How can I count the rows in my resultset? I'm using esql, but esql:row-count/ doesn't seem to be implemented yet. SQL COUNT(*)

Re: Counting rows in a resultset

2002-08-28 Thread Leszek Gawron
... xsp:logic int rowCount = 0; ... esql:execute-query ... esql:row-results ... xsp:logic rowCount++; try to do select count(*) as row_count from table;

Re: Counting rows in a resultset

2002-08-28 Thread Christian Haul
On 28.Aug.2002 -- 10:54 AM, Leszek Gawron wrote: try to do select count(*) as row_count from table; and then in esql:row-results do esql:get-long column=row_count/ I'm not 100% sure but this highly probable to work Yes, if it is an option to run the query twice this should work. The as

Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen
On Wed, 28 Aug 2002, Christian Haul wrote: On 28.Aug.2002 -- 10:54 AM, Leszek Gawron wrote: try to do select count(*) as row_count from table; and then in esql:row-results do esql:get-long column=row_count/ I'm not 100% sure but this highly probable to work Yes, if it is an option

Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen
Time to take out some heavier arms. Since I only need to get id and name from my table, I'm placing these pairs in a hashtable inside esql:row-results/. Then I have a nice hashtable, which I iterate through later on. hashtables size() method gives the rowCount. BUT: How to implement Enumeration

RE: Counting rows in a resultset

2002-08-28 Thread Koen Pellegrims
Try SELECT(id) FROM names WHERE id = 1; K. -Oorspronkelijk bericht- Van: Tuomo Lesonen [mailto:[EMAIL PROTECTED]] Verzonden: woensdag 28 augustus 2002 12:07 Aan: [EMAIL PROTECTED]; [EMAIL PROTECTED] Onderwerp: Re: Counting rows in a resultset On Wed, 28 Aug 2002, Christian

Re: Counting rows in a resultset

2002-08-28 Thread Christian Haul
On 28.Aug.2002 -- 01:29 PM, Tuomo Lesonen wrote: Time to take out some heavier arms. Since I only need to get id and name from my table, I'm placing these pairs in a hashtable inside esql:row-results/. Then I have a nice hashtable, which I iterate through later on. hashtables size() method

Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen
On Wed, 28 Aug 2002, Christian Haul wrote: On 28.Aug.2002 -- 01:29 PM, Tuomo Lesonen wrote: Time to take out some heavier arms. Since I only need to get id and name from my table, I'm placing these pairs in a hashtable inside esql:row-results/. Then I have a nice hashtable, which I

Re: Counting rows in a resultset

2002-08-28 Thread Andre Thenot
On Wednesday, August 28, 2002, at 06:06 , Tuomo Lesonen wrote: This doesn't work: SELECT COUNT(*), id, name FROM names WHERE id = 1; I'm using MS SQL2000. The query above is probably not well formed SQL, or SQL2000 doesn't know what to do with it... :( The count(*) syntax works in MySQL,