SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Counting voucher value total since the beginning of the month

    Hello,

    I have a table called "vouchers" it contains fields named "voucher_value" and "redeemed_at". redeemed_at is in Unix timestamp format (generated by PHP time() function).

    So I need get the total of voucher_value since the beginning of the month.

    What's the SQL code for that?

    Thanks.

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what have you tried?

    Hint, since you've stored values in UNIXTIME you'll have to convert that column using FROM_UNIXTIME.

    Also note it would be much easier if you merely used now() directly in mysql to update that column, then no conversion is necessary.


Bookmarks

Posting Permissions

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