Subject | RE: [firebird-support] Problem with 'UNION ALL' |
---|---|
Author | Svein Erling Tysvær |
Post date | 2009-09-14T06:41:12Z |
Do you get the same strange result if you use AS "TYPE" or AS pgv_type rather than AS type, Lester? I know that we were bitten by TYPE becoming a reserved word in IB6 or Fb1, though we simply changed to another field name and I haven't checked whether it has been removed from the reserved words since then.
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Lester Caine
Sent: 13. september 2009 10:23
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Problem with 'UNION ALL'
I'm playing with several things at once, including PDO:firebird in php,
but I think I've tracked the source of my problem to a strange result
from this query
SELECT 'INDI' AS type, COUNT(*) AS num FROM pgv_individuals WHERE i_file=1
UNION ALL
SELECT 'FAM' AS type, COUNT(*) AS num FROM pgv_families WHERE f_file=1
UNION ALL
SELECT 'NOTE' AS type, COUNT(*) AS num FROM pgv_other WHERE o_file=1
UNION ALL
SELECT 'SOUR' AS type, COUNT(*) AS num FROM pgv_sources WHERE s_file=1
UNION ALL
SELECT 'OBJE' AS type, COUNT(*) AS num FROM pgv_media WHERE m_gedfile=1
GROUP BY type
I'm only getting 4 results rather than the 5 expected, and strapping a
SELECT type, num FROM () around it does not help.
I know this could be done other ways, but the problem is that this is
working with other databases in PHP/PDO. PDO:firebird simply crashes
apache when it trys to fetch even the first result! But the first
problem is to sort out why the SQL fails - in FB2.1.3
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
Set
-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Lester Caine
Sent: 13. september 2009 10:23
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Problem with 'UNION ALL'
I'm playing with several things at once, including PDO:firebird in php,
but I think I've tracked the source of my problem to a strange result
from this query
SELECT 'INDI' AS type, COUNT(*) AS num FROM pgv_individuals WHERE i_file=1
UNION ALL
SELECT 'FAM' AS type, COUNT(*) AS num FROM pgv_families WHERE f_file=1
UNION ALL
SELECT 'NOTE' AS type, COUNT(*) AS num FROM pgv_other WHERE o_file=1
UNION ALL
SELECT 'SOUR' AS type, COUNT(*) AS num FROM pgv_sources WHERE s_file=1
UNION ALL
SELECT 'OBJE' AS type, COUNT(*) AS num FROM pgv_media WHERE m_gedfile=1
GROUP BY type
I'm only getting 4 results rather than the 5 expected, and strapping a
SELECT type, num FROM () around it does not help.
I know this could be done other ways, but the problem is that this is
working with other databases in PHP/PDO. PDO:firebird simply crashes
apache when it trys to fetch even the first result! But the first
problem is to sort out why the SQL fails - in FB2.1.3
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php