TED]>
To:
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 into:
A table has like 400,000 rows, with a primary key index id. I use this
query:
SELECT * FROM tab
he query to see what mysql is going to
do.
- Original Message -
From: "Peter Van Dijck" <[EMAIL PROTECTED]>
To:
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
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 i
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
[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]
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]
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.
-
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
sult = 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 BY date DESC");
> >
> > Everything works fine, but the ORDER BY bit sorts all date
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 BY
> date DESC"
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 be a regularly appearing problem, which is why
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
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 |
> +
mysql> desc albums;
+-+-+--+-+++
| Field | Type| Null | Key | Default| Extra |
+-+-+--+-+++
| album_ID| int(11) | | PRI | NULL | auto_increment |
|
-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, ";
>^^^
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 da
-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-
ER BY
clause is used string 'date'. That is why you get "wrong" sorting. Use
another alias for your date column, it should help you, i.e.:
$qry="SELECT id, module, week, ";
$qry.="DATE_FORMAT(date, \"%d %m %Y\") as mydate, ";
[s
[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 2
~~~
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
-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
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:
-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
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 attem
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
> 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 d
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 incorr
27 matches
Mail list logo