is not really good SQL. DISTINCT is not a function, so you should have no parentheses following it. It happens to work in this case, but it is to be avoided and anyhow the GROUP BY solution is more "canonical". MySQL for instance optimizes SELECT DISTINCT into GROUP BY internally.SELECT DISTINCT( group ) FROM table1 me ORDER BY group
Also GROUP BY is more flexible, whereas SELECT DISTINCT is an "all or nothing" thing: it applies to all fields in your SELECT statement.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re^5: Catalyst, DBIx::Class, SELECT DISTINCT and TT
by CountZero
in thread Catalyst, DBIx::Class, SELECT DISTINCT and TT
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |