SK
8th March 2006, 20:24
Hello everyone,
Nice forum you got here, hope you can lend me some of your expertise ;)
Unfortunately my source code is at work, where I don´t have a direct net connection, so I´ll try to put my problem into a few words.
I got a few SQL tables:
table address
ID City street nameRef
04 NY 5thAv 05
06 LA HBvd 06
09 SA whtever 08
table name
ID first sur
05 A. Peters
06 B. Jennings
08 C. Schlegel
What I want to have in the end is a table view showing me all this data in one table, e.g:
ID City street first sur
04 NY 5thAv A. Peters
06 LA HBvd B. Jennings
09 SA whtever C. Schlegel
(Bad formatting, but you should get the idea)
It´s easy to get one field from "table name" into "table address" by using QSqlRelationalTableModel and defining a relation. The problem now of course is, that I got 2 (and more in my real application) fields to be inserted instead of one. My first thought was to insert the number of needed columns, copy the "nameref" numbers into it and define as many relations as needed. This doesn´t work though, especially as I´m not allowed to edit the original database.
I hope I´m wrong on this one, looking forward to all replies.
Nice forum you got here, hope you can lend me some of your expertise ;)
Unfortunately my source code is at work, where I don´t have a direct net connection, so I´ll try to put my problem into a few words.
I got a few SQL tables:
table address
ID City street nameRef
04 NY 5thAv 05
06 LA HBvd 06
09 SA whtever 08
table name
ID first sur
05 A. Peters
06 B. Jennings
08 C. Schlegel
What I want to have in the end is a table view showing me all this data in one table, e.g:
ID City street first sur
04 NY 5thAv A. Peters
06 LA HBvd B. Jennings
09 SA whtever C. Schlegel
(Bad formatting, but you should get the idea)
It´s easy to get one field from "table name" into "table address" by using QSqlRelationalTableModel and defining a relation. The problem now of course is, that I got 2 (and more in my real application) fields to be inserted instead of one. My first thought was to insert the number of needed columns, copy the "nameref" numbers into it and define as many relations as needed. This doesn´t work though, especially as I´m not allowed to edit the original database.
I hope I´m wrong on this one, looking forward to all replies.