Posts: 3,176
Name: Thierry
Location: I'm the uber Spaminator !
|
Ok, again a quetion without specifying which database it is...
Taking a guess for mysql, the manual indicate that you can use an substring_index() function that fit nicely to your requirement:
http://dev.mysql.com/doc/refman/5.0/...ubstring-index
and it really does.
I used this script to test it:
Code:
drop table test1;
create table test1(
valid_host varchar(255),
created timestamp
);
insert into test1 values ('www.review-script.com,review-script.com',now());
select substring_index(valid_host,',',1) as valid_host, created from test1;
returns
Code:
+-----------------------+---------------------+
| valid_host | created |
+-----------------------+---------------------+
| www.review-script.com | 2009-09-30 08:38:56 |
+-----------------------+---------------------+
1 row in set (0.00 sec)
__________________
Only a biker knows why a dog sticks his head out the window.
|