problem with GROUP BY and ORDER BY
Posted on
16th Feb 2014 07:03 pm by
admin
i usually use this query to display the last 10 entries from a sql table:
Code: $query = "SELECT search_time, search_keywords FROM phpbb_popsearch ORDER BY search_time DESC limit 35";
as you can see it will order the results by "search_time" so the latest entries are listed first
Did you know?Explore Trending and Topic pages for more stories like this.
normally the result would be something like this:
Quotenew entry
duplicate
another entry
bla bla
348237
543543
duplicate
but now i just want to include a "GROUP BY" in this sql request
Code: $query = "SELECT search_time, search_keywords FROM phpbb_popsearch ORDER BY search_time DESC limit 35";
but with the GROUP BY my sql query isn't ordered correctly anymore.
the result would be something like this:
QuoteQuotenew entry
another entry
bla bla
348237
543543
duplicate
notice the "duplicate" entry was grouped together, but it's not in the second first position anymore ???
i was expecting a result like this:
Quotenew entry
duplicate
another entry
bla bla
348237
543543
Since entry called "duplicate" is the second last added entry....
i hope you understand what i mean
No comments posted yet
Your Answer:
Login to answer
175
43
Other forums
get url?
how do i get the url of the page i'm currently on, on my website.. i think its get header.. how do i
Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out wh
Help: problem with Headers to download PDF file
Hi,
I'm trying to implement a script where when a user clicks a link he gets a PDF file to op
Cron Job and Output
I have php codes running under a cron job.
But everytime i output (echo) , it comes out as comple
I got my hosting suspended XD
So I saw this challenge a day or so ago
http://www.programming-challenges.com/pg.php?page=dow
Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :
Help with email validation please...
Hi,
Please could you help.
I have a register.php login page where users register, the detail
private constructor
Hello,
Can we create a constructor as private? If yes, what is the use of it? If no, why can'
File upload issues
Hi Guys,
Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages
small inaccuracies
I have this code to convert fractional base 10 into base 2:
while($num > 0)