Results 1 to 3 of 3

Thread: Outer join in QSqlRelationalTableModel

  1. #1
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Outer join in QSqlRelationalTableModel

    Hello
    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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Outer join in QSqlRelationalTableModel

    J-P Nurmi

  3. #3
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Outer join in QSqlRelationalTableModel

    Hello
    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.

Similar Threads

  1. QDataTable + join
    By zlatko in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2006, 12:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.