Subject | RE: [firebird-support] Simple SQL question |
---|---|
Author | Yusuf Celik |
Post date | 2007-07-17T11:46:54Z |
Would there be a performance penalty?
Because, for each row SELECT for COUNT will be executed?
Regards
Yusuf
________________________________
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of joseph
Sent: Tuesday, July 17, 2007 12:34 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Simple SQL question
I would have done it like this:
Select t1.Field1, t1.Field2, SUM(t1.Field3),
(select count(*) from table1 t2) as totalcount
from t1.Table1
Group by 1,2
-----Original Message-----
From: firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com>
[mailto:firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com> ] On Behalf Of Yusuf Celik
Sent: Tuesday, July 17, 2007 11:59 AM
To: firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com>
Subject: RE: [firebird-support] Simple SQL question
I haven't tested but the following should work.
SELECT COUNT(*) FROM (
Select
Field1,
Field2,
SUM(Field3)
from Table1
Group by 1,2
)
Regards
Yusuf
________________________________
From: firebird-support@ <mailto:firebird-support%40yahoogroups.com>
yahoogroups.com
[mailto:firebird-support@ <mailto:firebird-support%40yahoogroups.com>
yahoogroups.com] On Behalf Of Michael
Vilhelmsen
Sent: Tuesday, July 17, 2007 10:47 AM
To: firebird-support@ <mailto:firebird-support%40yahoogroups.com>
yahoogroups.com
Subject: [firebird-support] Simple SQL question
Hi
I have a rutine in which I would like to have a progressbar.
The SQL is like this:
Select
Field1,
Field2,
SUM(Field3)
from Table1
Group by 1,2
I would like to be able to count how many records there will be
returned to me by this SQL.
Can I do that ?
Regards Michael
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Because, for each row SELECT for COUNT will be executed?
Regards
Yusuf
________________________________
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of joseph
Sent: Tuesday, July 17, 2007 12:34 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Simple SQL question
I would have done it like this:
Select t1.Field1, t1.Field2, SUM(t1.Field3),
(select count(*) from table1 t2) as totalcount
from t1.Table1
Group by 1,2
-----Original Message-----
From: firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com>
[mailto:firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com> ] On Behalf Of Yusuf Celik
Sent: Tuesday, July 17, 2007 11:59 AM
To: firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com>
Subject: RE: [firebird-support] Simple SQL question
I haven't tested but the following should work.
SELECT COUNT(*) FROM (
Select
Field1,
Field2,
SUM(Field3)
from Table1
Group by 1,2
)
Regards
Yusuf
________________________________
From: firebird-support@ <mailto:firebird-support%40yahoogroups.com>
yahoogroups.com
[mailto:firebird-support@ <mailto:firebird-support%40yahoogroups.com>
yahoogroups.com] On Behalf Of Michael
Vilhelmsen
Sent: Tuesday, July 17, 2007 10:47 AM
To: firebird-support@ <mailto:firebird-support%40yahoogroups.com>
yahoogroups.com
Subject: [firebird-support] Simple SQL question
Hi
I have a rutine in which I would like to have a progressbar.
The SQL is like this:
Select
Field1,
Field2,
SUM(Field3)
from Table1
Group by 1,2
I would like to be able to count how many records there will be
returned to me by this SQL.
Can I do that ?
Regards Michael
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]