Hey there,
i did not follow the beginning of this thread but this looks like a proper SQL query...and it should have nothing to do with the ODBC driver, because the driver just sends the query to the server and the server will run it. Could you please provide the error message you receive at running this query? And surely you can put this query in an SP but it should work also the way you wrote it. Szilvi ________________________________ From: Olaf Kluge <[email protected]> To: [email protected] Sent: Tuesday, February 12, 2013 12:39 PM Subject: AW: [firebird-support] sql query in firebird Hello again, now I have test it with a pass through query and it works! Thanks! Hello Sean Thanks a lot! Unfortunately the gemini interbase odbc driver works not with this union query. Even not if I create 3 single queries and call this in a union query. Is there an easy way to put them into a stored procedure without duplicates? Then I can get the return values by calling this stored procedure. Thank you. SELECT a.empf_sbnr, b.email FROM tbestellungen a join tsachbearbeiter b on a.empf_sbnr = b.sbnr WHERE a.status = 1 and b.email is not null UNION SELECT b.bauleiter as sbnr, e.email FROM tprojekte b join tsachbearbeiter e on b.bauleiter = e.sbnr JOIN tbestellungen a ON b.kommisionsnr = a.kommisionsnr and b.auftrag = a.auftrag where e.email is not null UNION SELECT c.sbnr, f.email FROM tprojversand c join tsachbearbeiter f on c.sbnr = f.sbnr JOIN tbestellungen a ON c.kommisionsnr = a.kommisionsnr and c.auftrag = a.auftrag where f.email is not null [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]
