I guess I found another bug with the Master / Detail function :
Create 3 Tables
MasterTable :
DetailTable:MasterId : Integer (autoinc)
Caption : Varchar 10
JoinTable:DetailId : integer (autoinc)
MasterId : integer
Caption : varchar 10
On a datamodule add 2 queries : one named QrMaster, the other one named QrDetails.JoinTableId : integer (autoinc)
DetailId : integer
Prize : double (15,2)
MasterId : Integer (autoinc)
Caption : varchar 10
On the QrMaster SQL :
On the QrDetail SQL :Select * From MasterTable
Set the mastersource property + details / Master fields (in this case to MasterId).Select DetailTable.*, JoinTable.* From DetailTable Left OuterJoin JoinTable on (DetailTable.DetailId = JoinTable.DetailId ) where DetailTable.prize 0 Order by DetailTable.Caption
Now try to open the Query : you will get an Error #23000 Column 'MasterId' in where clause is ambigious...
If I look with the DBMonitor , In can see that :
Select DetailTable.*, JoinTable.* From DetailTable Left OuterJoin JoinTable on (DetailTable.DetailId = JoinTable.DetailId ) where ( DetailTable.prize 0 ) And MasterId = : MasterID Order by DetailTable.Caption
This should be "DetailTable.MasterId = :MasterId"...
I've also tried to modify my where clause (by adding the "DetailTable.MasterId = :MasterId". This didn't worked since the component already added a new clause : "And MasterId = :MasterId"
When joinning the key, isn't it possible to select from witch table the Detail key will be taken ? ( having a drop down list from the selected table like you did in the "Generate insert/Delete/update/refrehs SQL Statement wizard" ) or even use the "UpdatingTable" property ?