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 and inside . I would suggest using

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 MyS

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 > > . Then I have a nice hashtable, which I iterate

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 > . Then I have a nice hashtable, which I iterate through > later on. hashtables "size()" method gives th

RE: Counting rows in a resultset

2002-08-28 Thread Koen Pellegrims
nting rows in a resultset > > > 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 P

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 > > >

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 . Then I have a nice hashtable, which I iterate through later on. hashtables "size()" method gives the rowCount. BUT: How to implement "Enumeration" interface

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 do > > > > I'm not 100% sure but this highly probable to work > > Yes, if it is an option to run the query twice this should

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 do > > 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 row_count" is not necessary if you access th

Re: Counting rows in a resultset

2002-08-28 Thread Leszek Gawron
> > ... > > > > int rowCount = 0; > > ... > > > > ... > > > > ... > > > > rowCount++; try to do select count(*) as row_count from table; and then in do I'm not 100%

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 > > > doesn't seem to be implemented yet. SQL COUNT(*) do

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 > > doesn't seem to be implemented yet. SQL COUNT(*) doesn't > > work in this case either. Can I do this with XSP? > > Yes

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 > 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 execute-query and ++ it