This will probably calculate the number of days: (julianday(date_out) - julianday(date_back) + 1) You need to use WHERE rowid = NEW.ROWID to restrict changes to the affected row. WHERE rental_cost IS NULL will update ALL of the rows that have a NULL rental cost The price in the subselect will be the one from the first Rental record visited in the subselect. I don't think that is what you intend. If you want the price from the affected row, just use NEW.price instead.