columns from pacjent tables are not added into wizyta table
Nothing in your code tries to add columns (or rows) to any database table.


Does the query exec() call return true? Does your lastError() report anything?

Does
Qt Code:
  1. SELECT id_wizyty, data, w.id_pacjenta, id_lekarza, p.imie as Imie_Pacjenta ,p.nazwisko as Nazwisko_Pacjenta
  2. FROM wizyta w
  3. JOIN pacjent p ON w.id_pacjenta = p.id_pacjenta
To copy to clipboard, switch view to plain text mode 
Execute in isql and return what you expect?

Does the execution enter your for loop? Is there a reason you did not use the more idiomatic:
Qt Code:
  1. while (q.next()) {
  2. // do stuff
  3. }
To copy to clipboard, switch view to plain text mode