473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Query to get All days per an extension Help please!

First thanks in advance for your help.

I am trying to do a query and am not sure if this is possible.

I have a table called Extensions:

ID Ext CDate
1 100 2/2/2005
2 101 2/3/2005
3 101 2/4/05

Then I have another table called DaysofMonth:

ID TheDay
127 2/1/2005
128 2/2/2005
129 2/3/2005
130 2/4/2005
131 2/5/2005
132 2/6/2005
133 2/7/2005
134 2/8/2005
135 2/9/2005
136 2/10/2005
137 2/11/2005

I would like to see 22 records 1 for each ext per day.
101 2/1
101 2/2
101 2/2
101 2/2 ...
101 2/11

102 2/1
102 2/2
102 2/2
102 2/2 ...
102 2/11

11 days per ext = 22 records

A cross join doesn't work because I would get 33 records. A outer
join on the date doesn't work either. I know there's got to be a way to
do this, but I can't think of one!!

Thanks

Nov 13 '05 #1
2 1521
Let me update this actually. On the Extensions table I have:
ID Ext CDate Calls
1 100 2/2/2005 5
2 101 2/3/2005 3
3 101 2/4/05 7

So I want to see every extension per day with the number of calls on
that day. If they don't have any calls then show 0
Thanks

Nov 13 '05 #2
AP
My friend and I have done this in the past, and its not the prettiest
way to do it, but it seems to work. Otherwise we have written code if
it needs to be cleaner.

It is a 2 query approach.

Query 1
Add the days table and the calls table, without joining the two. Pull
the day field from the day table and the extension from the calls
table. Add grouping to the query so you get a list of unqiue
combinations. This should produce a record for each extension to each
day from the day table.
Query 2
Add query one and the calls table. Link with an outer join on the
extension and date fields. (Showing all records from the Query One and
only those from the calls table where the is a match)

This should work for you. You may want to add an additional expression
that handles the nulls and converts them to zero, something like this:
= IIf(IsNull([calls]),0,[calls])

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: sah | last post by:
I need some help with the following query: DECLARE @SRV VARCHAR(20), @date smalldatetime SET @SRV = (select @@servername) SET @date = '20040901' select Srv_Name = @SRV, DB_Name = 'DB_NAME',...
2
by: tedhekman | last post by:
Hi there! I am pretty new to Access, have been loving learning it! I have a problem here I can't even begin to figure out. Here is what I need: Given 1 Date and 1 Store, retrieve the following...
5
by: emanuel.levy | last post by:
I have a table called tbl_employers. One of the fields is start_date. I'm trying to make a query that will show all entries where todays date is 275 days and 305 days after the start date. Any...
4
by: Derek Van Cuyk | last post by:
Hi everyone! I'm trying to write a web application in school that utilizes a MS Access database. I can read and everything fine from it but when I try to add a new record I get an exception that...
3
by: Skip | last post by:
OK, I'm a novice in JS but have lots of coding experience. I am trying to accomplish something that would seem somewhat simple - BUT IT'S NOT. I have a basic window that calls another window...
6
by: leeg | last post by:
Help please. Apologies but I am poor in access and programming :o) and am having trouble getting my head around this one!!...again!!! I need to have a query or report to flag up someone who has...
1
by: Jimbo | last post by:
I have a query..if you look at the bottom of the where clause you'll see an "NOT IN" statement that is really hanging up the query..i'm trying to replace with a "NOT EXISTS" but it isnt appearing...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: uno7031 | last post by:
Help Please!!! Adding 5 Days to another Date in an access query Good Morning, Help please…. I am new to access and trying to write a query that will add 5 days between a RecDate and a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.