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
ereg_replace()
Basically what i need to do is
$title = "This Suck's"
$striped = ereg_repl
upload form file types....
Hey all, I am learning PHP and I am writing a script from the W3C Schools tutorials for uploading fi
PHP Search Issue
Hi, I am using the following code to search and return flights from a database. The user searches by
adding up might be solved tell us cheers.
i think i finally solved this anybody.
last time i was getting the wrong results.
Code
how to get IP address?
hey guys,
i have this code which is supposed to get me the IP address of my site visitors:
Displaying values from a SQL count...
Hi,
Easy enough question i just forget the exact method ..
I have ...
Code: //count win
$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown
foreach result into a single variable
Hi,
I have this code...
Code: [Select]foreach ($_POST['Interests'] as $interest =&
timezone change with date()
so i put all my times for posts in my made from scratch forum(not phpbb3 or sm)
in my mysql db u
str_replace help
Hey there,
I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean