Home All Groups Group Topic Archive Search About

Inserting records back into temp table that don't exist

Author
21 Jul 2005 5:13 PM
Frank N via SQLMonster.com
I have a procedure that I'm trying to produce for a client. They want to see
total order counts each day from the 1st to the end of the month.

The procedure I have now will produce order counts for days that do exist. It
is using the order open date to pull orders from the orders table from
between a start and end date.

The client wants to see zero for the days that didn't have any activity.

For example:

Office          Day          Total
BranchA      1               50
BranchA      2                0
BranchA      3                10

How do I insert a blank record into my temp table that will show 0 for the
days that didn't pull?

Thanks so much in advance.


--
Message posted via http://www.sqlmonster.com

Author
21 Jul 2005 6:21 PM
Anith Sen
A general method is to create a dataset/table/view with all the days you
want to include and use an OUTER JOIN to get the results. If you want
specific query, please read www.aspfaq.com/5006 and post relevant
information to repro your problem.

--
Anith

AddThis Social Bookmark Button