We help IT Professionals succeed at work.

sql statement

thenone
thenone asked
on
Medium Priority
244 Views
Last Modified: 2010-07-27
I need a sql statement that will trim a fields content to 25 words.
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
what database?
some support the function left(), others it is substr() etc...

in SQL Server:

select left(yourfield, 25) from yourtable ...

Author

Commented:
sorry mysql version 5.0
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
MySQL has the same function
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:

Author

Commented:
so if I do select left(yourfield, 25) from yourtable then it will trim that fields content to 25 words or charcaters?
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
25 characters.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
how do i make it to words. Or is this possible?
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.