RE: [PHP] Re: A stupid question...
| From: | Tim Ward | Date: | Mon, 11 Mar 2002 12:20:23 +0000 |
| Subject: | RE: [PHP] Re: A stupid question... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87997@lists.php.net to get a copy of this message | ||
If you mean select by first letter then wild cards are what you want ...
http://www.mysql.com/doc/S/t/String_comparison_functions.html
<http://www.mysql.com/doc/S/t/String_comparison_functions.html>
in your case "SELECT ... WHERE lastname LIKE '$Letter%' ORDER BY lastname"
... if you mean sort all records but don't sort past the first letter then
"SELECT ..., LEFT(lastname, 1) AS lastname_first ... ORDER BY
lastname_first" or you might even be able to do " ... ORDER BY
LEFT(lastname, 1)" you'll have to experiment with that one.
Tim Ward
Internet chess www.chessish.com <http://www.chessish.com>
----------
From: Chuck "PUP" Payne [SMTP:cepayne@magidesign.com]
Sent: 11 March 2002 02:59
To: Cary; mysql lists.mysql.com
Cc: PHP General
Subject: Re: [PHP] Re: A stupid question...
I want to sort my a letter in a set colomn. Let say I want to sort
the
colomn last_name
http://www.myserver.com/mysort.php?Letter=A
Like to create a link like A then sort only the last name ore what
ever I
want to sort by that letter.
I hope that's helps. I can order by, but I can't so a sort like the
example
above.
Chuck Payne
Magi Design and Support
on 3/10/02 9:42 PM, Cary at cary@Ali-Co.com wrote:
> At 08:24 PM 3/10/02, Chuck \"PUP\" Payne wrote:
>> Hi,
>>
>> I not a newie but I am not a pro at mysql either. I want to do a
query by
>> letter(a, b, c..ect.). Is there a simple way to do it. I am
writing in PHP.
>> So can someone please so me the how.
>
>
> I'm not totally sure what your looking for. If you could elaborate
a little
> I am sure that one of us could help you out.
>
> Cary
>
>
>