I'm trying to create an sql query with multiple inner joins, but I can't manage this.
I have 3 tables (bookings, accountplan, costs), where the data come from.
In accountplan are hold the accounts, in costs the cost codes and their names, in bookings the booked events.
Based on a booking event, I need the account name, the name of the cost code and all data from bookings (I need the cred account name too, but I can't figure out yet, how I can get this)
I tried this:
"SELECT bookings.*, accountplan.accountname, costs.costname FROM bookings INNER JOIN accountplan ON bookings.debaccount=accountplan.account INNER JOIN costs ON bookings.costcode=costs.costcode"
It is here a where clause too, but I tested it, it's ok.
The above query results no rows. If I remove the costs table and the inner join with it, it works. What am I missing?
View Complete Post