Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2011
    Posts
    29
    Thanks
    2
    Thanked 0 Times in 0 Posts

    sql query for getting limited characters from record which is store in perticular col

    I have table gameinfo in that gamedesc column is there , in that column ,game description is there. So i want to display limited characters from that game description.
    which query i have to use for that? can anyone help me for this?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    It's usually better to do this in PHP/ASP/JSP code.

    Reason: You usually want to "cut" the text on a space and then add "..." to indicate there is more.

    But if you really want to do it in MySQL (or Access, or SQL Server), you can just do
    Code:
    SELECT LEFT(somefield,99) AS partialText, other, fields
    FROM table
    Change 99 to however many characters you want.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Jun 2011
    Posts
    29
    Thanks
    2
    Thanked 0 Times in 0 Posts
    it works. thank you very much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •