Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6825297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:00:22+00:00 2026-05-26T22:00:22+00:00

Im trying to graph the sum of orders occuring for a particular date for

  • 0

Im trying to graph the sum of orders occuring for a particular date for the last 7 days but am having a problem when their aren’t any orders for a particular date as the query isn’t a value nor a date and therefore returning an array less than 7.

SELECT IFNULL(COUNT(*),0) as purchase_count, DATE(tb_order.order_date) as order_date
                FROM tb_order_attendee_info
                JOIN tb_order on tb_order.order_id = tb_order_attendee_info.order_id
                JOIN tb_events on tb_events.event_id = tb_order.event_id
                 WHERE tb_order_attendee_info.refunded='N'  AND order_date between DATE_SUB(now(), interval 10 day) and now()
                GROUP BY DATE(tb_order.order_date)"; 

Ive been trying to work out how i can get it to return the array with zero values for purchase count and the incremented date, unfortunately its only returning a date when the count is greater than 0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:00:22+00:00Added an answer on May 26, 2026 at 10:00 pm

    You are trying to introduce result rows where there are none in the data. This is just not possible (without using a Stored Procedure). You cannot iterate over the dates as, so to say, there are no for loops in SQL.

    The closest you can get is having/creating a (temporary) table of all the dates you want to have in the result and then JOIN to this table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use graph batch api , is there any reference code
i am trying to bulid this graph... heres the problem TAKE A LOOK AT
I am trying to create a bar graph using the matplot library but I
I am trying to solve the maxium flow problem for a graph using Ford–Fulkerson
The graph I'm currently trying to make falls a little between two stools. I
I'm trying to display an svg graph with associated javascript in my application using
I am trying to draw a graph showing search prefixes using twopi. I have
I'm trying to make a ggplot graph wich show the proportions of a variable
I am trying to represent a graph using disjoint union and record. The following
I am trying to retrieve information through Facebook graph api, using the below code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.