Re: Affected Rows
From: Amonotod (amonotod_at_charter.net)
Date: 01/24/05
- Next message: Jeff Benton: "Re: DBD::CSV and joins"
- Previous message: Ron Savage: "Re: Searchable archive for the DBI mailing list?"
- Maybe in reply to: Hernan Arredondo: "Affected Rows"
- Next in thread: Jenda Krynicky: "Re: Affected Rows"
- Reply: Jenda Krynicky: "Re: Affected Rows"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: <dbi-users@perl.org> Date: Mon, 24 Jan 2005 15:47:50 -0600
> From: amonotod <amonotod@charter.net>
> Date: 2005/01/24 Mon PM 02:03:18 CST
> > From: Hernan Arredondo <hernan.arredondo@gmail.com>
> > Date: 2005/01/24 Mon PM 12:41:56 CST
> > anyone knows other easy method ?
> FROM THE DOCS!
> <snip>
> One alternative method to get a row count for a SELECT is to
> execute a ``SELECT COUNT(*) FROM ...'' SQL statement with the same
> ``...'' as your query and then fetch the row count from that.
> </snip>
I guess I should have pointed out that the part you really need to take notice of was the last paragraph, in which it is suggested that you run a "select count()" before you run your real query.
One extra piece of advice, it says "select count(*)", but I suggest you use just "select count(<first_column>)" instead.
Also, keep in mind that you're not guaranteed that the return from the "select count()" is the actual number of rows you'll get back from your "select ..." statement. The accuracy obviously depends on level of activity in your database...
HTH,
amonotod
--
`\|||/ amonotod@ | sun|perl|windows
(@@) charter.net | sysadmin|dba
ooO_(_)_Ooo____________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
- Next message: Jeff Benton: "Re: DBD::CSV and joins"
- Previous message: Ron Savage: "Re: Searchable archive for the DBI mailing list?"
- Maybe in reply to: Hernan Arredondo: "Affected Rows"
- Next in thread: Jenda Krynicky: "Re: Affected Rows"
- Reply: Jenda Krynicky: "Re: Affected Rows"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|