Web Analytics Made Easy -
StatCounter short_desc - CodingForum

Announcement

Collapse
No announcement yet.

short_desc

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • short_desc

    Hi guys,
    I need to restrict the output in a column to a set number of characters. How do I go about doing this?

    I believe that I must use

    attributename.short_desc

    But how do I get this to work and how do I state the number of characters needed? there are a number of tables being used to get the data needed and these all work fine...I just cant get the short description bit to work.

    Thank you in advance
    Vic
    :O)

  • #2
    I would use the SUBSTRING function to achieve the result. See also
    http://www.mysql.com/doc/en/String_functions.html

    So your query could look like this to get the first 30 chars: (untested)

    Code:
    SELECT SUBSTRING(attributename.short_desc, 0, 30) AS something FROM tablename WHERE condition
    A little pseudo-code like, but the general principle should be clear.
    De gustibus non est disputandum.

    Comment

    Working...
    X