n8w Posted March 17, 2006 Share Posted March 17, 2006 Hello,I have a colum in a table that is an id .. and I have a prefix of "999" on the id (I know this wasn't the best table structure .. but I am retrofitting something.)for example id 1 looks like9991id 2 looks like 9992etc .. I would like to select this column but just the characters after the first "999" which would be 1,2,etcsomething like select id(after 3 chars) from mytablethanksn8w Quote Link to comment https://forums.phpfreaks.com/topic/5177-sql-statement-select-part-of-a-field/ Share on other sites More sharing options...
Barand Posted March 17, 2006 Share Posted March 17, 2006 MySql SUBSTRING function. Similar to php substr except first position is 1 in MySql[code]SELECT SUBSTRING(id, 4) as id FROM mytablename[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5177-sql-statement-select-part-of-a-field/#findComment-18410 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.