Jump to content

Gathering Data for a Daily Report


firefox53074

Recommended Posts

Need report in PHP to pull a total number of items that are sent to the queues in a particular day and for orders that are completed from the queues in a single day. There is a list of ten different queues that I'm needing to gather this data from and pull into a csv file. I'm needing to use an array with if-then statement or case statements. I'm not sure what other information I'm going to need or where to start at. 

example of the statement
IN_Queue[ ]
foreach ($in_queue as $item)
case match 1112
#test _cnt++;
continue 

queue test
select distinct item_number from queue_test WHERE search_type = '1112';

queue test 2 
select distinct item_number from queue_test2 WHERE search_type = '1111';

So for the two examples above I am just pulling the distinct item_number but I'm needing a total count of items that was submitted and completed for those queues on a single day. I have a list of ten queues that I need that information from. So I will need to pull the total count of submitted and have it output into a csv file into a column called test submitted and the completed go to test completed for day.

Link to comment
Share on other sites

First of all, whenever I see names like

  • queue_test
  • queue_test2

then alarm bells start ringing to alert of bad design.

 

What is the current structure of those "queue_test" tables?

I'm not exactly sure what you mean by that? Those are just sample names that I chose for an example. 

Link to comment
Share on other sites

So for the two examples above I am just pulling the distinct item_number but I'm needing a total count of items that was submitted and completed for those queues on a single day.

 

Then you don't need DISTINCT. Instead run the query for the records you want and 1) Use a GROUP BY on the item_number with a COUNT() clause in the select list. Something like this

 

SELECT item_number, COUNT(item_number) as item_count
FROM queue_test
WHERE search_type = '1112'
  AND date_completed = CURDATE()
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.