hi could anyone help me? I want join two tables into one, this code is working on my friends qt+db2 but on my qt+ingres isn't.

Qt Code:
  1. void FouDialog::on_pushButton_4_clicked()
  2. {
  3. int num_rows, r, c;
  4. QSqlQuery q(db);
  5.  
  6. if(!q.exec("SELECT count(id_wizyty) as num_rows FROM wizyta")) qDebug() << q.lastError().text();
  7. q.first();
  8. num_rows = q.value(0).toInt();
  9.  
  10. ui->tableWidget->setRowCount(num_rows);
  11.  
  12. //if(!q.exec("SELECT * FROM wizyta ")) qDebug() << q.lastError().text();
  13. if(!q.exec("SELECT id_wizyty, data, w.id_pacjenta, id_lekarza, p.imie as Imie_Pacjenta ,p.nazwisko as Nazwisko_Pacjenta FROM wizyta w JOIN pacjent p ON w.id_pacjenta = p.id_pacjenta")) qDebug() << q.lastError().text();
  14. for(r = 0, q.first(); q.isValid(); q.next(), ++r){
  15. for(c = 0; c < 6; ++c){
  16. ui->tableWidget->setItem(r,c, new QTableWidgetItem(q.value(c).toString()));
  17. }
  18. }
  19. }
To copy to clipboard, switch view to plain text mode