Hallo Folks,
first, let me say im sorry for my bad english.
I've got a Firebird Database with 3 Tables:
ARTIKEL
ARTIKEL_EAN
ARTIKEL_RETURNABLE_BOTTLE
First ARTIKEL:
with the columns
ARTNR ARTNA ARTPR
===== ===== =====
1 Apple 0,50
2 Beer 0,99
3 Fish 2,99
...
ARTIKEL_EAN
with the columns
ARTNR EAN
===== ====
1 401235465
2 132456789
3 400567890
....
ARTIKEL_RETURNABLE_BOTTLE
with the columns
ARTNR RETURNABLE
===== ====
2 468
I'm using a shellscript on Suse to execute my query and save it to an *.csv-File. Here is my Script:
Code:
#!/bin/sh
# Phath to DB, to the ISQL-Tool and UID, PWD
PATH_ISQL=/opt/firebird/bin/isql
PATH_DB=usr/local/data/DB.gdb
DBUSER="USER"
DBPW="PASS"
ISQL_ARGS="-b"
# Path to the home-directory
PATH_HOME=/usr/local/
#Path to the place where the .csv is saved
PATH_CSV=${$PATH_HOME}/output.csv
# SQL-Query
QUERY="SELECT a.ARTNR, a.ARTNA, e.EAN, a.ARTPR, p.RETURNABLE, FROM ARTIKEL a LEFT JOIN ARTIKEL_EAN e ON a.ARTNR = e.ARTNR LEFT JOIN ARTIKEL_RETURNABLE_BOTTLE p ON a.ARTNR = p.ARTNR;"
# Read the Path csv and execute in
PATH_CSV
# the isql tool
$PATH_ISQL $ISQL_ARGS > $PATH_CSV << EOF
CONNECT localhost:${PATH_DB} user ${DBUSER} password ${DBPW};
$QUERY
EOF
#-----------------SKRIPT ENDE ------------------------#
Now i get the following result:
ARTNR ARTNA EAN ARTPR RETURNABLE
<null>
2 Beer 132456789 0,99 468
<null>
But it should be:
ARTNR ARTNA EAN ARTPR RETURNABLE
1 Apple 401235465 0,50 <null>
2 Beer 132456789 0,99 468

3 Fish 400567890 2,99 <null>
So only if there a returnable bottle i get an result. Where's my mistake?
Thank you for your help
andras