Jump to content

Search the Community

Showing results for tags 'mysql php current week'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello, Hopefully someone will be able to shed some light on this as I am stumped! Basically I have a website were users enter deals into. I have two tables in my database: One called "users" - This stores user information for example user ID username password etc. Another table called "deals" - This stores deal information. Deal name, deal ID, user ID (which user did the deal), Deal amount, and Date the format for date is (YYYY-MM-DD). I am now trying to display the total amount of deals done by each user for a current week for each day. For example in a 7 day calander type of style: USERS SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY USER 1 £65 £70 £56 £38 £87 £33 £44 USER 2 £65 £70 £56 £38 £87 £33 £44 USER 3 £65 £70 £56 £38 £87 £33 £44 Hopefully this makes sense so far! These are the sql queries i've come up with so far... This selects each deal done in the current week: SELECT u.firstname, d.customername, d.dealamount, d.dealdate FROM deals d, users u WHERE u.uid = d.useriD AND YEARWEEK( dealdate ) = YEARWEEK( CURRENT_DATE ); For example: USER 1 DEAL1 £65 2013-03-15 USER 1 DEAL2 £65 2013-03-16 SELECT SUM( d.dealamount ) , u.firstname FROM deals d, users u WHERE u.uid = d.userid AND YEARWEEK( dealdate ) = YEARWEEK( CURRENT_DATE ) GROUP BY u.firstname USER 1 £130 Can anyone help expand on this so it comes out with current days along the top? Thanks in advanced!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.