There are tables: "Units of measurement" code name

"Substances" code code_unit_measurement name

"Substances" substance code code number

I use QSqlTableModel and QTableView to display the "Substance Inputs" table. It is necessary that in the table in addition to the fields of the table “Substances of substances” the unit of measurement is displayed (one more column). Should it be done via LEFT JOIN? That is, inherit from QSqlTableModel and make your own query?

    1 answer 1

    Use the QSqlRelationalTableModel class, in it you can specify the QSqlRelation with which to build a cast with a JOIN

    • For an existing column. That is, here in the table there should be a field coding_unit. - LFDS 2:07 pm