J
J
john_hack82020-07-08 17:55:55
SQL
john_hack8, 2020-07-08 17:55:55

DISTINCT in SQL doesn't give the right information?

Good evening, I created a table in Postgres, imported data from csv into it, output distinct by a certain field (store id, data type specified int when creating) and everything seems to be fine, except that the store id equal to 1 does not get into the output At the same time, queries with the condition: where id_store = 1 work correctly. Broke his head. With what it can be connected?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2020-07-08
@Stalker_RED

You didn't show the table structure or the query, so it's just a matter of guessing where exactly the problem is.
Most likely, you need not just distinct, but distinct on (...)
The documentation has examples with different options

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question