ORDER BY SQL

ORDER BY SQL

kmskms Posts: 15Questions: 2Answers: 0
edited August 2016 in Free community support

Hi, I require a certain range of values to be specified by month order e.g. 1 = January to 12 = December in the html table that I have created while using DataTables.

To date I only see the months in alphabetical order as opposed to month by month order and have implemented an ORDER BY clause in the sql query.

Note that if I display the ID field values in the html table then the table displays the months in the correct order and not alphabetical order. However, I do not want to display the ID field values and instead only want to display the name of the months in the table.

Please advise how to get this working correctly.

I thank you for any support or advice given.

Replies

  • ewmantheiewmanthei Posts: 14Questions: 1Answers: 2

    Do you have a link? This seems like a pretty straight-forward fix.

  • NineForty5NineForty5 Posts: 9Questions: 0Answers: 2

    You can just hide the month id field using columnDefs option: (column index is zero based)

    $(document).ready(function() {
          $('#example').DataTable( {
            "columnDefs":[
              {"visible": false,  "targets": [ 0 ]}
              ]
            });
        });
    
This discussion has been closed.