How to select DISTINCT with Datatables 1.10.4 ?
How to select DISTINCT with Datatables 1.10.4 ?
zlen
Posts: 5Questions: 2Answers: 1
I havn't found the answer in the forums.
I have two columns named col1 and col2 in my database, and I would like to "SELECT DISTINCT col1 FROM ..."
Is there a way to do this with DataTables 1.10.4 ?
I use the SSP class via this url : http://www.datatables.net/examples/data_sources/server_side.html
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You do not have to use the ssp.class.php in that example; it is simply an example. The only requirement is the return.
But it looks like you could change line 220 from:
to
The <code> and </code> tag is just a tilde, I'm not sure why that happens inside the three tilde chunk. Also, if you make multiple tables with more complicated queries it would definitely be worth writing your own class file.
Thank you for your quick reply !
I am very reluctant as to change the classes of developer.
To achieve my goal, I need to do a select distinct first and then a join. But your answer helped me ! Thanks a lot !
Then, if I need to join with others tables, I use this modified SSP class : https://github.com/emran/ssp/blob/master/ssp.php
Perhaps modifying the class to add a
distinct()
method that would add theDISTINCT
condition tot he SQL would be a good way of doing it.Allan