Selecting only the first 50 characters of a certain column with mysql.
I know that there is a special artibute for this, But i can't seem to remember what it is...
use the substring function:
SELECT SUBSTRING(column,0,50) FROM your_table;
by the way, i have to say i am very happy to see that your first idea was to use SQL.
is it possible to alias a column and use SUBSTR?
SELECT SUBSTRING(column,0,50) as columnSummary FROM your_table;
I tried it just like that, and it didn't seem to work, is my syntax wrong, or do i need to review my php?
maybe you should post some code.
well i have already found a work around for this, and because i am on a tight schedule for work, i'll have to move on for now. I appreciate the help, next time i need to use the SUBSTRING function, I will try your suggestion, and If i continue having problems, I will return here and post the code.
Thanks again chazzy,
ok, well most likely either the database version/vendor you use doesn't support substring (at least not that function name) or you have another error in your code.
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)