Subject RE: [firebird-support] Problem with 'UNION ALL'
Author Alan McDonald
> 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

Have you tried a union of 5 views?
Alan