How to copy one column of a table into another table’s column in PostgreSQL comparing same ID

UPDATE public.clean_trips_byobu
SET trip_dist = clean_trips.bktp_mt_total
FROM public.clean_trips 
WHERE public.clean_trips.obu_id = clean_trips_byobu.obu_id
AND clean_trips.bktp_trip_id = clean_trips_byobu.trip_id;

Hope it will work for you.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)