473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Most recent entries, different order

Hi,

I have a table containing a "time" and an "author" column. How is it possible
to select the 10 most recent entries, but sorted by "author"?

Thanks for any help!
Jul 19 '05 #1
6 4965
"Igor Fedorow" <ig**********@NO.SPAM.obda.net> wrote in message news:<bk**********@newsreader1.netway.at>...
Hi,

I have a table containing a "time" and an "author" column. How is it possible
to select the 10 most recent entries, but sorted by "author"?


select * from your_table order by time desc, author asc limit 10;
Jul 19 '05 #2
_dotTSim_ wrote:
select * from your_table order by time desc, author asc limit 10;

No, that won't work as first it'll order by time, then by author, which
doesn't really "sort by author".
--
Sugapablo
------------------------------------
http://www.sugapablo.com <--music
http://www.sugapablo.net <--personal

Jul 19 '05 #3
"Igor Fedorow" <ig**********@NO.SPAM.obda.net> wrote in message news:<bk**********@newsreader1.netway.at>...
Hi,

I have a table containing a "time" and an "author" column. How is it possible
to select the 10 most recent entries, but sorted by "author"?


select * from your_table order by time desc, author asc limit 10;
Jul 19 '05 #4
_dotTSim_ wrote:
select * from your_table order by time desc, author asc limit 10;

No, that won't work as first it'll order by time, then by author, which
doesn't really "sort by author".
--
Sugapablo
------------------------------------
http://www.sugapablo.com <--music
http://www.sugapablo.net <--personal

Jul 19 '05 #5
Sugapablo <ru********@sugapablo.com> wrote in message news:<vn************@corp.supernews.com>...
_dotTSim_ wrote:
select * from your_table order by time desc, author asc limit 10;

No, that won't work as first it'll order by time, then by author, which
doesn't really "sort by author".


This query would work so:
first,will order result by time (the last 10 entries),
second, will order for each same entries (if exist) author...

infact won't work like wish our friend..

But with MySQl < 3.23.* and PHP i'll try this:
stored into an array (e.g $result[]) the result of this query:
"select time,author from your_table order by time desc, author asc limit 10;"

than fill an array like this: $entries[$result['author']]=$result['time'];

then order by name the array according to the index!
P.S. Sorry my bad english...i'm not enghlis/american!
Jul 19 '05 #6
Sugapablo <ru********@sugapablo.com> wrote in message news:<vn************@corp.supernews.com>...
_dotTSim_ wrote:
select * from your_table order by time desc, author asc limit 10;

No, that won't work as first it'll order by time, then by author, which
doesn't really "sort by author".


This query would work so:
first,will order result by time (the last 10 entries),
second, will order for each same entries (if exist) author...

infact won't work like wish our friend..

But with MySQl < 3.23.* and PHP i'll try this:
stored into an array (e.g $result[]) the result of this query:
"select time,author from your_table order by time desc, author asc limit 10;"

than fill an array like this: $entries[$result['author']]=$result['time'];

then order by name the array according to the index!
P.S. Sorry my bad english...i'm not enghlis/american!
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nova's Taylor | last post by:
Hi folks, I am a newbie to Python and am hoping that someone can get me started on a log parser that I am trying to write. The log is an ASCII file that contains a process identifier (PID),...
0
by: Igor Fedorow | last post by:
Hi, I have a table containing a "time" and an "author" column. How is it possible to select the 10 most recent entries, but sorted by "author"? Thanks for any help!
6
by: Brad Kent | last post by:
I have a problem that can be summarized with a simple table having the following 3 columns: timestamp userid status The table is constantly being updated. I'd like to get the most recent row...
2
by: Randy Jackson | last post by:
First of all, I apologize in advance if this is covered somewhere in a FAQ. I did a Google search, but really couldn't find anything. I'm having a problem with a simple select query. I've got...
3
by: TJM | last post by:
hello, I have a table which contains the audit time field. This audit time field records the current date and time when a record is inserted. I would like to output the most recent top 500 rows....
2
by: R. Heydenreich | last post by:
Hi all, I try to create an index page from a document. The idea behind is to collect a certain word and list it with *all* occurences in the document, like foo .... 12, 23, 45 bar .... 2, 5,...
6
by: Mark | last post by:
hi, i want to display the five most recent rows in my table (there is a timestamp), but sorted in ascending order. the problem is that when i call SELECT * FROM spam ORDER BY time ASC LIMIT...
2
by: robert.waters | last post by:
I need to perform the following: - select the most recent X number of records in a table (there is a timestamp field) - select the Nth occurrence of X number of records ex: - most recent 10...
3
by: AnthonyT | last post by:
Hi All I have a major problem with an access query and I am near the end of my tether! I have taken over a project with a badly built access database and as resources are not available to start...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.