Board index » delphi » SQL union and ODBC

SQL union and ODBC

I am modifying a Delphi 2 application in order to use a remote database
through ODBC in place of the local Interbase server.
All (long ?) queries which apply the UNION operator to two base SELECT
statements fail with ODBC where they worked fine with the local IB
server. I think the problem relies inside BDE, so I am looking for a way
to split each one of these queries in two basic queries and to join
afterwards their individual results, the final result of the query being
displayed using a TDBGrid component.
How can I perform the union of two distinct data sets (TQuery) and
display the result in a TDBGrid ?
Any suggestion would be very helpful. Thanks in advance.
--
________________________________________________________________________
Pierre HABRAKEN

Tl    : 04 76 51 43 62
Fax    : 04 76 51 45 63
E-Mail : Pierre.Habra...@ujf-grenoble.fr

Dpartement Scientifique Universitaire
Universit Joseph Fourier
Adresse postale : CAFIM/DSU BP53 38041 Grenoble Cedex 9
________________________________________________________________________

 

Re:SQL union and ODBC


Quote
Pierre Habraken <Pierre.Habra...@ujf-grenoble.fr> wrote:
> I am modifying a Delphi 2 application in order to use a remote database
> through ODBC in place of the local Interbase server.
> All (long ?) queries which apply the UNION operator to two base SELECT
> statements fail with ODBC where they worked fine with the local IB

Don't think it's the BDE. After all, even Local Sql supports Unions in BDE 3.
It's probably in the ODBC driver, I guess.

Quote
> server. I think the problem relies inside BDE, so I am looking for a way
> to split each one of these queries in two basic queries and to join
> afterwards their individual results, the final result of the query being
> displayed using a TDBGrid component.
> How can I perform the union of two distinct data sets (TQuery) and
> display the result in a TDBGrid ?

Batchmove the first result to a temporary table in batCopy mode, then batchmove
the second result to the same table in batAppend mode. Select from the temp.
table.

Happy coding.

Jasper

Re:SQL union and ODBC


I have had the same problem. The solution using views does not work.
I have not resolved yet  and  I also think it is a bug in the BDE.
Javier

Quote
Pierre Habraken <Pierre.Habra...@ujf-grenoble.fr> wrote:
>I am modifying a Delphi 2 application in order to use a remote database
>through ODBC in place of the local Interbase server.
>All (long ?) queries which apply the UNION operator to two base SELECT
>statements fail with ODBC where they worked fine with the local IB
>server. I think the problem relies inside BDE, so I am looking for a way
>to split each one of these queries in two basic queries and to join
>afterwards their individual results, the final result of the query being
>displayed using a TDBGrid component.
>How can I perform the union of two distinct data sets (TQuery) and
>display the result in a TDBGrid ?
>Any suggestion would be very helpful. Thanks in advance.
>--
>________________________________________________________________________
>Pierre HABRAKEN
>Tl    : 04 76 51 43 62
>Fax    : 04 76 51 45 63
>E-Mail : Pierre.Habra...@ujf-grenoble.fr
>Dpartement Scientifique Universitaire
>Universit Joseph Fourier
>Adresse postale : CAFIM/DSU BP53 38041 Grenoble Cedex 9
>________________________________________________________________________

Other Threads