- Original Message -
Subject: RE: ORDER BY problem
Try your query with either back quotes around Company
SELECT * FROM Contacts WHERE Categories="Services" and BusinessCodes
REGEXP
"^R" and gold_id="2" ORDER BY `Company` ASC
Or no quotes around C
Try your query with either back quotes around Company
SELECT * FROM Contacts WHERE Categories="Services" and BusinessCodes REGEXP
"^R" and gold_id="2" ORDER BY `Company` ASC
Or no quotes around Company
SELECT * FROM Contacts WHERE Categories="Services" and BusinessCodes REGEXP
"^R" and gold_id="
At 17:00 -0600 9/10/04, René Fournier wrote:
I've got a SELECT statement that is returning
the data I want, but not in the right order (and
I don't know why...). Let's say there are two
tables, People and History. Some records in
People have corresponding records in History,
but not all--so I
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Friday 10 September 2004 18:00, René Fournier wrote:
> I've got a SELECT statement that is returning the data I want, but not
> in the right order (and I don't know why...). Let's say there are two
> tables, People and History. Some records in Peopl
andy thomas wrote:
Well, this was fixed in the end by this query:
select substring_index(surname,' ',-1) as r from advisers order by r
which produced the desired result. But we have since had complaints from
individuals wanting their surnames sorted differently! People from Germany
with surname
,-1) from advisers' does the
> > trick as far as extracting the wanted parts of surnames at the end of
> > the surname filed but I'm not sure how to use this as an argument to
> > ORDER BY? Shouldn't something like:
> >
> > select substring_index(surname,&
> Sent: 08 June 2004 15:57
> > To: Andy Eastham
> > Cc: Mysql List
> > Subject: RE: RE - Order By Problem
> >
> > On Tue, 8 Jun 2004, Andy Eastham wrote:
> >
> > > Look at using the Reverse() function, then take the substring up to the
> > >
o
ORDER BY? Shouldn't something like:
select substring_index(surname,' ',-1) as r from advisers, select * from
advisers order by r
work?
Thanks for your help,
Andy
-----Original Message-
From: Paul McNeil [mailto:[EMAIL PROTECTED]
Sent: 08 June 2004 14:04
To: [EMAIL PROTECTED]
Subj
Andy,
Just:
select substring_index(surname,' ',-1) as r from advisers order by r;
works.
Andy
> -Original Message-
> From: andy thomas [mailto:[EMAIL PROTECTED]
> Sent: 08 June 2004 15:57
> To: Andy Eastham
> Cc: Mysql List
> Subject: RE: RE - Order By Pro
-Original Message-
> > From: Paul McNeil [mailto:[EMAIL PROTECTED]
> > Sent: 08 June 2004 14:04
> > To: [EMAIL PROTECTED]
> > Subject: RE - Order By Problem
> >
> > I have never done anything like this but after looking at the spec's I
> > have
>
Look at using the Reverse() function, then take the substring up to the
first space, then reverse the result.
Andy
> -Original Message-
> From: Paul McNeil [mailto:[EMAIL PROTECTED]
> Sent: 08 June 2004 14:04
> To: [EMAIL PROTECTED]
> Subject: RE - Order By Problem
>
&
On Tue, 8 Jun 2004, Vadim P. wrote:
> If "surname" is a field, then use it without the single quotes ('),
> otherwise it is treated as a literal string and 0 is the correct result:
>
> select locate(' ',surname,1) from advisers
Thanks a lot, this is working. I now need to figure out how to
If "surname" is a field, then use it without the single quotes ('),
otherwise it is treated as a literal string and 0 is the correct result:
select locate(' ',surname,1) from advisers
andy thomas wrote:
Yes, this is the approach I was thinking of using but:
select locate(' ','sur
On Tue, 8 Jun 2004, Paul McNeil wrote:
> I have never done anything like this but after looking at the spec's I have
> a possible direction for you
>
> In String functions there is
>
> LOCATE(substr,str,pos)
> The first syntax returns the position of the first occurrence of substring
> substr
I have never done anything like this but after looking at the spec's I have
a possible direction for you
In String functions there is
LOCATE(substr,str,pos)
The first syntax returns the position of the first occurrence of substring
substr in string str. The second syntax returns the position
The following might help, but will certainly be quite slow:
SELECT ... ORDER BY ABS(SUBSTRING(field, 4));
A better (and faster) solution will probably be indexing the records with
a numeric field, as usual.
Fred,
Doesn't MySQL always physically sort the rows and not use the
index to ob
At 06:49 AM 1/23/2004, Sagar C Nannapaneni wrote:
Hi all,
I have an ID field in my database...it reads like this
ASS1
ASS23
ASS4
ASS10
ASS6
.
.
.
when i'm retrieving the data by taking ORDER BY clause it is sorting like this
ASS1
ASS10
ASS23
ASS4
ASS6
means its only sorting by the 4 the characte
Sagar C Nannapaneni wrote:
ASS1
ASS23
ASS4
ASS10
ASS6
.
.
when i'm retrieving the data by taking ORDER BY clause it is sorting like this
ASS1
ASS10
ASS23
ASS4
ASS6
means its only sorting by the 4 the character.
No, it's not sorted by the first four characters but it's sorted
lexicographically (st
Martijn Tonies wrote:
Hi,
==
I have an ID field in my database...it reads like this
ASS1
ASS23
ASS4
ASS10
ASS6
when i'm retrieving the data by taking ORDER BY clause it is sorting like
this
ASS1
ASS10
ASS23
ASS4
ASS6
means its only sorting by the 4 the character. i want the sorting to be done
lik
Hi,
==
I have an ID field in my database...it reads like this
ASS1
ASS23
ASS4
ASS10
ASS6
when i'm retrieving the data by taking ORDER BY clause it is sorting like
this
ASS1
ASS10
ASS23
ASS4
ASS6
means its only sorting by the 4 the character. i want the sorting to be done
like the following
==
Am Sonntag, 16. Februar 2003 21:15 schrieb Paul DuBois:
> At 20:43 +0100 2/16/03, sascha mantscheff wrote:
> >The following query works with mysql 3.23:
> > SELECT * FROM answer ORDER BY concat( n_sort, "-", id_answer )
> >It does not with mysql 3.22.27. Neither does any query with a function
>
At 20:43 +0100 2/16/03, sascha mantscheff wrote:
The following query works with mysql 3.23:
SELECT * FROM answer ORDER BY concat( n_sort, "-", id_answer )
It does not with mysql 3.22.27. Neither does any query with a function call
in the order by clause. Is this documented somewhere? Am I missing
assuming you have a table with two columns id and town
then here's one solution:
> Create temporary table address (ad varchar(30));
> Insert into address select concat(id, ' ', town)
from your_original_table_name;
> select * from address order by ad;
--- Nicolas JOURDEN <[EMAIL PROTECTED]>
wrote
On 11 Jul 2002, at 16:06, Dan Lamb wrote:
> I'd like it to order like this:
>
> aristo 156
> aristo 222
> aristo 1001
>
> How can I do this in MySQL? Is there a way to take the numbers into
> account when using order by?
There are various ways to break up your strings and convert part to a
n
[snip]
I'm having trouble with ordering. I've got data in a varchar field that
currently gets ordered like this when I use 'order by myfield asc':
aristo 1001
aristo 156
aristo 222
I'd like it to order like this:
aristo 156
aristo 222
aristo 1001
How can I do this in MySQL? Is there a way to
"J.M. Roth" wrote:
>
> Hello,
>
> I just installed the newest MySQL (3.23.32) with PHP 4.0.4pl1 (shared
> module) on an Apache 1.3.12 (Linux).
>
> Some SQL syntaxes that worked before don't anymore.
> E.g.:
>
> $query = "SELECT * FROM $userstable ORDER BY when DESC LIMIT 0, 3";
> doesn't wor
* J.M. Roth <[EMAIL PROTECTED]> wrote on 28.01.01 02:05:
> I just installed the newest MySQL (3.23.32) with PHP 4.0.4pl1 (shared
> module) on an Apache 1.3.12 (Linux).
>...
> $query = "SELECT * FROM $userstable ORDER BY when DESC LIMIT 0, 3";
> doesn't work:
>From your query I think you upgraded
27 matches
Mail list logo