Hello friends, I have two questions and hope someone could suggest something.
-
Is is possible to round up specified fields in mysql database columns? If it is how can this be achieved?
-
I want to round up 4 fields in the query below so that the comparison on those 4 fields would be without errors since the two fields do not have the exact number of significant figures. Rounding these fields should checkmate error. How can I do it in the query below on the latitude and server_latitude, longitude and server_longitude.
I want to simply add the rounding up to the query which is working already. Thanks for your help. Below is the query:
UPDATE (
SELECT r.rmc_time, r.rmc_date, r.latitude, r.longitude, IF(s.server_rmc_time IS NULL AND s.server_rmc_date IS NULL AND s.server_latitude IS NULL AND s.server_longitude IS NULL, ‘mobile’, ‘both’) c FROM rmc_raw_data r
LEFT JOIN server_log_data s
ON r.rmc_time = s.server_rmc_time AND r.rmc_date = s.server_rmc_date AND r.latitude = s.server_latitude AND r.longitude = s.server_longitude
UNION
SELECT s.server_rmc_time, s.server_rmc_date, s.server_latitude, s.server_longitude, IF(r.rmc_time IS NULL AND r.rmc_date IS NULL AND r.latitude IS NULL AND r.longitude IS NULL, ‘server’, ‘both’) c FROM rmc_raw_data r
RIGHT JOIN server_log_data s
ON r.rmc_time = s.server_rmc_time AND r.rmc_date = server_rmc_date AND r.latitude = server_latitude AND r.longitude = s.server_longitude
) t
LEFT JOIN rmc_raw_data r1
ON r1.rmc_time = t.rmc_time AND r1.rmc_date = t.rmc_date AND r1.latitude = t.latitude AND r1.longitude = t.longitude
LEFT JOIN server_log_data s1
ON s1.server_rmc_time = t.rmc_time AND s1.server_rmc_date = t.rmc_date AND s1.server_latitude = t.latitude AND s1.server_longitude = t.longitude
SET
r1.data_source = c, s1.data_source = c;
Regards
Paul