Hi all,
this is a problem I'm running into:
A table has like 400,000 rows, with a primary key index id. I use this query:
SELECT * FROM table WHERE id IN (58, 25, 75, ...) ORDER BY post_date
DESC LIMIT 0, 40
The problem is, it uses the index id and then a FILESORT.
Questions:
1) Am I correct
what mysql is going to
do.
- Original Message -
From: Peter Van Dijck [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Tuesday, June 20, 2006 3:08 AM
Subject: Query question: select * from table where id in (1,2,3) order by date
uses FILESORT
Hi all,
this is a problem I'm running
, 2006 3:08 AM
Subject: Query question: select * from table where id in (1,2,3) order
by date uses FILESORT
Hi all,
this is a problem I'm running into:
A table has like 400,000 rows, with a primary key index id. I use this
query:
SELECT * FROM table WHERE id IN (58, 25, 75, ...) ORDER
I want to sort by date but the last date appears first. How to write such query?
TH
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
[snip]
I want to sort by date but the last date appears first. How to write
such query?
[/snip]
RTFM ORDER BY theDate DESC
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
write:
order by date desc
DeRyl
- Original Message -
From: Jerry Swanson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 05, 2004 8:00 PM
Subject: ORDER by date: reverse order
I want to sort by date but the last date appears first. How to write such query?
TH
Hi,
I have a query from tables that give me records with two date date1 and
date2. How can I order the records by the most recent date (between the
two date) for each records ? Example:
Data:
IDdescriptiondate1date2
1 aaa09/03/02 09/05/02
2
Xavier,
select
ID,
description,
if (ifnull(date1, 20201231) ifnull(date2, 20201231), ifnull(date1,
20201231), ifnull(date2, 20201231)) as date
from MyTable
order by date
I didn't test it, but it should work.
Any questions? don't hesitate to ask.
Best regards,
Mikhail.
- Original
This must be a regularly appearing problem, which is why i'm surprised I
can't find a webpage on it..
I have
$result = mysql_query(SELECT title, url, description, author,
date_format(date,'%D %M %Y') AS date FROM documents_tbl, url_tbl WHERE
documents_tbl.title_id = url_tbl.url_id ORDER
.
On Mon, 29 Jul 2002, julian haffegee wrote:
Date: Mon, 29 Jul 2002 17:59:00 +0100
From: julian haffegee [EMAIL PROTECTED]
To: MySQL General List [EMAIL PROTECTED]
Subject: order by date
This must be a regularly appearing problem, which is why i'm surprised I
can't find a webpage on it..
I have
title, url,
description, author,
date_format(date,'%D %M %Y') AS date FROM
documents_tbl, url_tbl WHERE
documents_tbl.title_id = url_tbl.url_id ORDER BY
date DESC);
Everything works fine, but the ORDER BY bit sorts
all dates as 9th, 8th 7th
etc rather than 31st, 30th and so on.
can
a string 20020729. I don't see how this could be sorted
incorrectly, but check your types.
On Mon, 29 Jul 2002, julian haffegee wrote:
Date: Mon, 29 Jul 2002 17:59:00 +0100
From: julian haffegee [EMAIL PROTECTED]
To: MySQL General List [EMAIL PROTECTED]
Subject: order by date
This must
mysql desc albums;
+-+-+--+-+++
| Field | Type| Null | Key | Default| Extra |
+-+-+--+-+++
| album_ID| int(11) | | PRI | NULL | auto_increment |
|
Never mind ... I made a mistake in the SQL statement !!! :-)
Son Nguyen
--- Son Nguyen [EMAIL PROTECTED] wrote:
mysql desc albums;
+-+-+--+-+++
| Field | Type| Null | Key | Default| Extra |
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi all
I've been searching for a solution to the following:
Is there an easy way to order by date ( - MM - DD), at the moment my
results are coming back with the *day* ordered but not the whole date
like this:
02 02 2002
03 03 2005
18 02 2003
Nick,
Tuesday, May 07, 2002, 12:06:31 PM, you wrote:
NW I've been searching for a solution to the following:
NW Is there an easy way to order by date ( - MM - DD), at the moment my
NW results are coming back with the *day* ordered but not the whole date
NW like this:
NW 02 02 2002
NW 03 03
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Victoria Reznichenko declared
NW I've been searching for a solution to the following:
NW Is there an easy way to order by date ( - MM - DD), at the moment my
NW results are coming back with the *day* ordered but not the whole
~~~
5/7/2002 6:01:09 PM, Nick Wilson [EMAIL PROTECTED] wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Victoria Reznichenko declared
NW I've been searching for a solution to the following:
NW Is there an easy way to order by date ( - MM - DD), at the moment
[snip]
NW Is there an easy way to order by date ( - MM - DD), at the moment
my
NW results are coming back with the *day* ordered but not the whole date
NW like this:
NW 02 02 2002
NW 03 03 2005
NW 18 02 2003
NW See what I mean?
[/snip]
If the date is in the format above you can
, \%d %m %Y\) as mydate, ;
[skip]
$qry.=ORDER BY date ASC;
NW $qry.=ektione, title, teacher_id ;
NW $qry.=FROM $this-table ;
NW $qry.=WHERE module = '$module' ;
NW $qry.=ORDER BY date ASC;
NW Thanks very much for the help!
--
For technical
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Jay Blanchard declared
If the date is in the format above you can select a substring
+++
| field1 | rDate |
+++
| 1 | 2002-03-01 |
| 2 | 2002-03-03 |
| 3 | 2002-03-05
Quoting Nick Wilson ([EMAIL PROTECTED]):
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Victoria Reznichenko declared
NW I've been searching for a solution to the following:
NW Is there an easy way to order by date ( - MM - DD), at the moment my
NW results
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Victoria Reznichenko declared
NW and here is my select:
NW $qry=SELECT id, module, week, ;
NW $qry.=DATE_FORMAT(date, \%d %m %Y\) as date, ;
The
Hi,
I've noticed this problem, even if I don't know if it's really a mysql problem:
if I store a date in standard format, in a date field, all kinds of
ordering are OK.
But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
the order by clause attempt to order the new format
But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
the order by clause attempt to order the new format
incorrectly, because
I've an output like this: 12-2-2002, 12-3-2002, 12-4-2002,
and 13-2-2002!!!
I normally do this:
SELECT DATE_FORMAT(datefield,'%d-%m-%Y') as
Wakan [EMAIL PROTECTED] wrote:
But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
the order by clause attempt to order the new format incorrectly, because
I've an output like this: 12-2-2002, 12-3-2002, 12-4-2002, and 13-2-2002!!!
What can you say about this?
Can you give
Hi,
Wakan wrote :
Hi,
I've noticed this problem, even if I don't know if it's really a mysql problem:
if I store a date in standard format, in a date field, all kinds of
ordering are OK.
But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
the order by clause attempt to
27 matches
Mail list logo