Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    137

    Unanswered: mysql format number

    Hi,

    I want to know how can I format a number like this:

    year = 2012
    month = 7

    it should be:

    year = 2012
    month = 07

    then bill_code = 201207 (as int)

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    choose whichever answer you like --

    1. do it in your front end language, not in mysql

    2. use SMALLINT(2) with ZEROFILL

    3. don't build a column from two other columns
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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