Skip to main content
March 5, 2009
Question

How to get this value?

  • March 5, 2009
  • 3 replies
  • 460 views
Please see attached code
    This topic has been closed for replies.

    3 replies

    Participating Frequently
    March 21, 2009
    I think this should be your solution:


    SELECT columnname
    FROM tablename

    <cfoutput query="queryname">
    #ListGetAt(columnname,2,"_")#<br>
    </cfoutput>

    Hope this helps!
    Inspiring
    March 11, 2009
    as Dan has suggested, this is best done on the db level, using your db's
    built-in string manipulation functions. most databases has an array of
    these functions you can use, like SUBSTR() or SUBSTRING() or
    STRING_INDEX() etc etc - check you db manual for correct function to
    use. then you query sql would look something like:

    SELECT somecolumn, SUBSTR(somecolumn, ) AS somealias
    FROM sometable

    you could also get your desired output at output time using CF's
    string/list functions like listlast():

    SELECT somecolumn
    FROM sometable

    <cfoutput query="somequery">
    #listlast(somecolumn, "_")#<br>
    </cfoutput>

    but it is much more efficient to do this on the db level...


    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    Inspiring
    March 5, 2009
    If your db allows it, you can select substrings.
    March 10, 2009
    is this what you want?