Regular Expression during SELECT

Hi to all.
Excuse my bad english but I have a problem with a query.

I have a table with a colum with datas formatted like this:
name//surname

For example:

ID | INFO
1 | George//Bush
2 | Silvio//Berlusconi

What I need is a SELECT with an order by the surname. In the example it
must return
2 and than 1 because Berlusconi is lower than Bush.

I think a regular expression will be fit for this task but I don't know
how to use it.
I'm using PostGre SQL with allow subSelection.

Thanks to all for any help.
amadei [ Mi, 31 Mai 2006 17:18 ] [ ID #1337006 ]

Re: Regular Expression during SELECT

Save yourself the headache and format your tables properly

Mr.Mime wrote:
> Hi to all.
> Excuse my bad english but I have a problem with a query.
>
> I have a table with a colum with datas formatted like this:
> name//surname
>
> For example:
>
> ID | INFO
> 1 | George//Bush
> 2 | Silvio//Berlusconi
>
> What I need is a SELECT with an order by the surname. In the example it
> must return
> 2 and than 1 because Berlusconi is lower than Bush.
>
> I think a regular expression will be fit for this task but I don't know
> how to use it.
> I'm using PostGre SQL with allow subSelection.
>
> Thanks to all for any help.
zac.carey [ Mi, 31 Mai 2006 19:26 ] [ ID #1337008 ]

Re: Regular Expression during SELECT

Yes you should make a good table. Your table structure is not good. Its
better like this:
-----------------------------
ID | surname | name
-----------------------------

You can make a script to clean your old table.

--
http://www.padbuilder.com
http://www.mastervb.net
lorento [ Di, 06 Juni 2006 12:26 ] [ ID #1344239 ]
PHP » alt.php.sql » Regular Expression during SELECT

Vorheriges Thema: Importing HTML
Nächstes Thema: MySQL hosting plans.