You are here: Re: Retrieving and sorting names from MySQL « PHP Programming Language « IT news, forums, messages
Re: Retrieving and sorting names from MySQL

Posted by himilecyclist on 05/16/06 17:56

Rik wrote:

> Yep, don't CONCAT. What's the particular use you had in mind for this
> anyway?
>
> SELECT fields
> FROM table
> WHERE Last >='$_POST[txtSrchLastName]'
> AND First >='$_POST[txtSrchFirstName]'
> AND Middle >='$_POST[txtSrchMiddleName]'
> ORDER BY Last, First, Middle
> LIMIT 200
>
> Or if you want to keep your CONCAT:
>
> SELECT CONCAT(Last, First, Middle)
> FROM table
> WHERE Last >='$_POST[txtSrchLastName]'
> AND First >='$_POST[txtSrchFirstName]'
> AND Middle >='$_POST[txtSrchMiddleName]'
> ORDER BY Last, First, Middle
> LIMIT 200
>
> Grtz,
> --
> Rik Wasmus

Thanks, Rik.

The application is a database of vital event records (death records in
this case). The users want to be able to enter a name to search for
and then have the list box populated with names, starting with the name
entered to search for, and then proceeding for 200 records, sorted by
last, first, middle.

I considered the solution you have suggested, but am almost certain it
won't fit our needs. For example, if the user searches for last name
"Smith" and first name "Susan", the search will indeed start with Susan
Smith, but as soon as last name "Sorensen" and first name "Anna" is
reached, this record will not be included since "Anna" is not >=
"Susan".

I still can't think of any solution other than padding each of the
names involved (search strings and names returned from the database)
with spaces. Not being very familiar with SQL, I'm not sure how to do
that on the database side.

Any more ideas? Thanks!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация