SQL Query - GREATEST & REPLACE

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
phoggy
Forum Newbie
Posts: 20
Joined: Tue Sep 16, 2003 2:03 pm

SQL Query - GREATEST & REPLACE

Post by phoggy »

Hi everyone,
I have a field in my db with numbers like '20;30;10;50' (all in one field). I want to remove all but the highest number. Can I use syntax like the one below? It's not working for me.

SELECT GREATEST(REPLACE(Price, ";", ",")) as Price FROM nsninfo

UPDATE nsninfo SET Price = GREATEST(REPLACE(Price, ";", ","))

Thanks.
phoggy
Forum Newbie
Posts: 20
Joined: Tue Sep 16, 2003 2:03 pm

Post by phoggy »

Never mind, it does work
[edit]
I take that back it doesn't: i get an error when running:
"parse error, unexpected ',' "
Anybody know why?
Post Reply