PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → UNION on HExecuteSQLQuery()
UNION on HExecuteSQLQuery()
Iniciado por Alejandro Santacatalina, 20,oct. 2017 18:01 - No hay respuesta
Publicado el 20,octubre 2017 - 18:01
Hello,
I have 3 tables and I want to show the columns from t1 that have the Column1 value on the t2 or t3. I try an Union sql sentence but it seems like not works with HExecuteSQLQuery().

The query is something like this:
cQry is string = [
SELECT t1.Column1, t1.Column2 FROM t1 JOIN t2 on t1.Column1 = t2.Column1
UNION
SELECT t1.Column1, t1.Column2 FROM t1 JOIN t3 on t1.Column1 = t3.Column1
]

The function:

HExecuteSQLQuery(DataSource, hQueryDefault, cQry)
HReadFirst(DataSource)

Finally I had an Error on HReadFirst(), DataSource is null.

Thank you!