Answer the question
In order to leave comments, you need to log in
How to get only the first value in a table?
There is a request:
SELECT to_char(date, 'YYYY-MM-dd HH24:MI:ss') as day,
title, email, price, pages
FROM customer
Answer the question
In order to leave comments, you need to log in
SELECT DISTINCT ON (day),
to_char(date, 'YYYY-MM-dd HH24:MI:ss') as day, title, email, price, pages
FROM customer
С учётом изменения вопроса:
SELECT to_char(c.date, 'YYYY-MM-dd HH24:MI:ss') as day,
c.title, c.email, c.price, c.pages
FROM (
SELECT MIN(date) AS date, email FROM customer GROUP BY email
) AS t
JOIN customer AS c ON c.date = t.date AND c.email = d.email
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question