$this->db->distinct() weirdness with PostgreSQL |
[eluser]redguy[/eluser]
I was trying to get a distinct list of questions, but the distinct function doesn't work (with PostgreSQL). The following code: Code: $this->db->distinct(); Code: SELECT DISTINCT * FROM "questions" Code: SELECT DISTINCT ON ("question") * FROM "questions" See PostgreSQL manual for reference. The distinct() function only takes a boolean, so supplying the column name doesn't help.
[eluser]Seppo[/eluser]
DISTINCT ON accepts one or multiple field according to the docs... does it accept * too? I'm asking this because the MySQL behaviour un distinct is removing duplicated rows using all columns and I don't see in the postgre manual if it's valid
[eluser]redguy[/eluser]
Something like: Code: SELECT DISTINCT * is possible. But that just returns every row, since each row has/should an unique identifier. It's also not SQL compliant. In PostgreSQL you always have to supply at least one column name. |
Welcome Guest, Not a member yet? Register Sign In |