MSSQL - SELECT DISTINCT

226 views
Skip to first unread message

Pavel Polívka

unread,
Mar 2, 2012, 4:34:06 AM3/2/12
to not...@googlegroups.com
Hi,

I need to use construction "SELECT DISTINCT" on MSSQL database. Is there any support (or will be) for this?
I can use workaround by using:
$table->select('DISTINCT table.column') which will generate: SELECT DISTINCT table.column FROM table

But the problem occurs, when I need to add limit:
$table->limit('10') which will generate: SELECT TOP(10) DISTINCT table.column FROM table
This SQL query has syntax error, because it should be: SELECT DISTINCT TOP(10) table.column FROM table

Thanks for any advices or information about this topic.

Jakub Vrana

unread,
Dec 21, 2013, 10:13:44 AM12/21/13
to not...@googlegroups.com, Pavel Polívka
You can use group() instead.

Jakub
Reply all
Reply to author
Forward
0 new messages