I would like to display on a TDbgrid data from 2 tables on a single database file. I have tried to write sql statements like:
select "Client", "Address", "Balance" from "table1"
and "Payment" from "table2"
But it always shows this error
SQL Error: Dynamic SQL Error DQL Error code = -104 Token Unknown - line 2,
column1 and.Error -104.Invalid token The SQL: select "Client", "Address", "Balance"
from "table1"
and "Payment" from "table2"
I don't know if it is not possible or I just got error on writing the code or is it the TDbgrid I need to modify. I searched for a zeos sql guide but I cannot find one. All I got was this: http://www.intitec.com/varios/A_ZEOS_basics_tutorial_not_only_for_firebird.pdf but still some of my questions are left unanswered.
I am using firebird database 2.5 and delphi 7.
What SQL code can I use on this?
Your syntax is invalid.
SELECT * FROM table1, table2
However, the above doesn't make sense either, as you're selecting every column and row from two separate tables with no means of connecting the two tables.
Table1
ColumnA ColumnB
======= =======
Nonsense Here
Orange Noise
Table2
ColumnC ColumnD
======= =======
Horse Radish
No Sense
SELECT * FROM Table1, Table2
Result:
ColumnA ColumnB ColumnC ColumnD
======= ======= ======= =======
Nonsense Here Horse Radish
Orange Noise No Sense
Even after your edit, there's no sense in the query.
SELECT Table1.ColumnA, Table1.ColumnB, Table2.ColumnC, Table2.ColumnD
FROM Table1, Table2
still yields the same results.
You really should look for tutorials on database programming and SQL in general. Google can help.