Reputation: 333
I need to select limited number of characters from one column. I've tried :
SELECT substring_index(COLUMN_NAME, 250);
BUT the column name will be identified as normal text string.
EXAMPLE : I have column "Description" and I want to retrieve first 250 characters of the description to put into php variable.
It works when using substring NOT substring_index.
Upvotes: 0
Views: 127
Reputation: 3225
Do you just need to add "AS Description" after the substring function call so the column gets renamed back to just Description in your PHP result array?
Upvotes: 1
Reputation: 16362
With more clarification from the poster, putting the answer here, in case he/she chooses to accept it.
substring(description,1,250)
Upvotes: 1