Hello everybody, I am trying to insert in the letter field the first letter of the FILEDX's content, How can i do it???
Any ideas is most appreciated, thanks
![]()
| SitePoint Sponsor |
Hello everybody, I am trying to insert in the letter field the first letter of the FILEDX's content, How can i do it???
Any ideas is most appreciated, thanks
![]()





Check out Substr/substring()
Thanks for your swift reply rguy84, i will check it now
you are right, but when i chop the characters and get, how can i deal with it to insert it in the second field, please if you have idea
SELECT SUBSTRING('artist_name',1,1) this is it what i was looking, now i will try to find out how to insert it into the second field, if you have any idea while mine goes well its most appreciated, with lots of thanks
Thanks,Yes infact this worked with me too
insert into tbl1 (letter)
SELECT SUBSTRING('field',1,1)
from tbl2
But now i will do compare using where field's ID = same ID to be inserted respectively
And also i want to use UPDATE instead of insert because some fields contains some data, hope if you have any suggestions, with my infinite thanks
Code:UPDATE table SET letter = SUBSTRING(field, 1, 1)
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget


Also i have checked this one it works
SELECT LEFT(FIELD, 1)FROM TABLE
UPDATE TABLE
SET letter = SUBSTRING(FIELD, 1, 1)
where id=id2
With this we did it, same thanks to all of you guys for today we have solved our problem and we achieved our duty... thanks AGAIN


why would you want to have a separate column containing the first letter only?
homework?![]()
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget
Now if i want to use this code it is giving error, please need your attention with this dear guys
because i want to delete all records except who have catid 40DELETE * fromTABLE WHERE catid !='40'
With thanks


what is the exact error you got?


didn't you just say "Now if i want to use this code it is giving error" ???
Bookmarks