lord_shadow
17th October 2008, 12:02
I have a QSqlQuery as follows:
QSqlQuery q("SELECT video.codVideo, video.codSupporto, video.title, SUM(availableNol) AS available
FROM video INNER JOIN dvd ON (video.codSupporto=dvd.codSupporto) AND (video.codVideo=dvd.codVideo)
GROUP BY video.codVideo, video.codSupporto, title");
Then I created a queryModel and a QSqlRecord called record..everything OK the table is correctly printed and I can retrieve almost all fields except the one called available which is a calculated one..I tried:
int disp = record.value(3).toInt();
qDebug()<<"available: "<<disp;
but qDebug always returns 0 even if it is correctly printed in the table view.
Is it a problem retrieving calculated values in a query? :confused: :confused:
QSqlQuery q("SELECT video.codVideo, video.codSupporto, video.title, SUM(availableNol) AS available
FROM video INNER JOIN dvd ON (video.codSupporto=dvd.codSupporto) AND (video.codVideo=dvd.codVideo)
GROUP BY video.codVideo, video.codSupporto, title");
Then I created a queryModel and a QSqlRecord called record..everything OK the table is correctly printed and I can retrieve almost all fields except the one called available which is a calculated one..I tried:
int disp = record.value(3).toInt();
qDebug()<<"available: "<<disp;
but qDebug always returns 0 even if it is correctly printed in the table view.
Is it a problem retrieving calculated values in a query? :confused: :confused: