Previous: , Up: Useful Queries   [Contents][Index]


9.1.2 Useful Queries for Testing

Copy location records for user with id 1 to user with id 2

INSERT INTO location (user_id, location, "time", hdop, altitude, speed, bearing)
SELECT 2, location, "time", hdop, altitude, speed, bearing FROM location WHERE user_id = 1;

Moved yesterday’s test location data forward by 1 day:

UPDATE location SET time = time + INTERVAL '1 day'
WHERE user_id='1' AND time >= now()::timestamp::date - INTERVAL '1 day'
AND	time <= now()::timestamp::date;