Page 1 of 1

TmyQuery Update

Posted: Wed 04 Oct 2006 10:35
by khh
I have this query attached to DBGrid

Code: Select all

SELECT
  tbl_pupils.ID,
  CONCAT(tbl_pupils.FirstName, " ", tbl_pupils.LastName) AS FullName,
  tbl_subjects.title,
  tbl_grades.ft,
  tbl_grades.fp,
  tbl_grades.ft + tbl_grades.fp AS total
FROM
  tbl_grades,
  tbl_pupils,
  tbl_subjects
WHERE
  tbl_grades.PID = tbl_pupils.ID AND
  tbl_grades.BID = tbl_subjects.ID

How to update (ft & fp) in (Grades) table using this SQL with DBGrid.

Posted: Thu 05 Oct 2006 10:06
by Antaeus
We can suggest two ways to solve this problem. The first one is to set name of the table you want to edit to UpdatingTable property of TMyQuery component. The second way is to assign corresponding SQL statement to SQLUpdate property. It will be executed on each post of edited record.

Posted: Thu 05 Oct 2006 10:27
by Antaeus
Note that you should include primary key of the table you want to edit into your SELECT statement.