Make a query for get partial text
I need to make a query (mysql database) for get the content of a specific texarea field. For do that I use the follow query:
Using this query allow me to get the full content of the texarea for each of my users but my goal was to get only the first 200 character and not the full text. Somebody told me is possible to do something using the SQL functions such as SUBSTR but I don't know how to include this function in my query.
SELECT `mytextareacolumn` FROM `my_table` WHERE `user_id` = [user_id]
I'm not a coder just a poor newbie.
Anybody can suggest me something please?
just use substring function in you query, it will look like:
It should be something like that, but I'm not 100% sure
SELECT SUBSTRING(mytextarea,1,200) as `mytextarea` FROM `my_table` WHERE `user_id`=[user_id]
Sorry, i dont know how to edit the post, but I have made a wrong there, it should be:
SELECT SUBSTRING(mytextarea,1,200) FROM `my_table` WHERE `user_id`=[user_id]
sorry guy I forget to thank you
Yes now all is fine for me. In my case the following query do the job:
all the best
SELECT SUBSTRING(`myfieldname`,1,200) FROM `mytable` WHERE `user_id` = '[user_id]'
Last edited by dotcom22; 11-16-2012 at 09:01 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)