• Resolved mart08812

    (@mart08812)


    Hello, I am trying to display the last entry for each property listed in a table. Can this be filtered in wpdatatables?

    Not knowing how to do that I have been trying to modify the db query to import the last entry by property by grouping the property and selecting the highest id per group but I cannot get this query working either.

    SELECT icomprealestatequickstats.id, icomprealestatequickstats.userid, icomprealestatequickstats.property, icomprealestatequickstats.pricedate, icomprealestatequickstats.listprice, icomprealestatequickstats.squarefeet, icomprealestatequickstats.squarefootprice, icomprealestatequickstats.numrooms, icomprealestatequickstats.numbedrooms, icomprealestatequickstats.numbathrooms, icomprealestatequickstats.locationrating FROM icomprealestatequickstats WHERE id, IN ( SELECT MAX(id) FROM icomprealestatequickstats GROUP BY property );

    Hope you can help. The things I think should be simple……;) thnx!

Viewing 1 replies (of 1 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hi there, thank you for your inquiry,

    Your guesses are mostly right – as ID is usually auto-increment you could prepare something like this (you would need to store it in a MySQL view to use in wpDataTables, as LIMIT clause is not allowed):

    SELECT * FROM icomprealestatequickstats ORDER BY id DESC LIMIT 1;

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘filter for last row in grouped data sets’ is closed to new replies.