Thread: mySQL question
09-27-2004, 06:35 PM #1
- Member Since
- Jul 25, 2004
- Gaithersburg, MD
- Mac Pro 2.6ghz Quad Xeon, 23" Cinema
I was wondering how to only get the first x number of characters in an SQL query. Like if you have a field called job_description and you want to only display the first 50 chars or so as a "preview." Do you think it would be easier to use a built-in PHP function to crop it or is there a way to do it with the select statement. I don't have any of my reference books handy so I can't look it up.
09-28-2004, 12:11 AM #2I'm in your forums, writing sentences in a grammatically acceptable manner.
09-28-2004, 04:44 PM #3
- Member Since
- Jun 11, 2003
- Mount Vernon, WA
- MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Returns the leftmost len characters from the string str.
mysql> SELECT LEFT('foobarbar', 5);
-> 'fooba'---> Join the Mac-Forums Folding team: use 37954 as your team number.
View Mac-Forums Folding team statistics (More Info)
Don't forget to use the User Reputation System
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By burnedfaceless in forum Web Design and HostingReplies: 1Last Post: 02-03-2014, 09:36 AM
By mguise in forum Web Design and HostingReplies: 0Last Post: 07-06-2011, 06:39 PM
By hintbanana in forum Web Design and HostingReplies: 3Last Post: 02-06-2008, 05:03 AM
By Dark Phoenix in forum Web Design and HostingReplies: 4Last Post: 04-11-2005, 07:54 PM
By ftjogoh in forum Web Design and HostingReplies: 3Last Post: 11-21-2004, 12:29 PM