This PostgreSQL query basically displays a list of data that is older for 12hours.
SELECT * FROM listing_websites
WHERE ( ( NOW() - last_visited ) > INTERVAL '12 hour' OR last_visited IS NULL )
GROUP BY url,pkey ORDER by pkey ASC
Displayed data will look like these. pkey is the "primary key"
pkey | url | last_visited
12 | link1 | 2012-11-08 17:06:49.553515
13 | link2 | 2012-11-07 05:36:55.270243
14 | link1 | 2012-11-09 08:54:33.51958
15 | link3 | 2012-11-03 16:29:17.20889
17 | link1 | 2012-11-08 05:54:33.51958
What I want to achieve is to group the url column for example:
pkey | url | last_visited
12 | link1 | 2012-11-08 17:06:49.553515
13 | link2 | 2012-11-07 05:36:55.270243
15 | link3 | 2012-11-03 16:29:17.20889
Thanks in advance whoever can figure this out. I'm still learning postgresql anyway especially in the GROUP BY function. TIA