View Full Version : Outer join in QSqlRelationalTableModel

1st April 2008, 07:05
I am using a QSqlRelationalTableModel for a database table which has a foreign key relationship with a lookup table.

My question is that when I use model.setRelation, the SQL query that is created to populate the model uses an inner join. So, if a record has a foreign key equal to null, it is not returned to the model.

How would I change this query to an outer join to allow for nullable foreign keys?

Thanks in advance

1st April 2008, 07:28
199697 - QSqlRelation optimisation

2nd April 2008, 00:19
Thanks for that. In the interim is there a way to achieve this before this feature or should I stick to your previous suggestion about adding null records to lookup tables.
Thanks again.