M
marc_donofrio
Hi
I am trying writing a SQL query to pass into an Chart in access. My
problem is i need to combine 2 querys together to give me the two lines
in the chart. Using the wizards this is no problem but i want to use
sql so i can pass variables into the query to make it easily updatable
by the user.
query1 called "06"
SELECT Format([bkdate],"mmm") AS [Date],
Count((Format([bkdate],"yymm"))) AS NumBookings,
(Format([bkdate],"mm")) AS [Month]
FROM dbo_tblBook
GROUP BY Format([bkdate],"mmm"), (Format([bkdate],"mm")),
Format([bkdate],"mmm yy")
HAVING (((Format([bkdate],"mmm yy")) Like "*06"))
ORDER BY (Format([bkdate],"mm"));
query2 called "07"
SELECT Format([bkdate],"mmm") AS [Date],
Count((Format([bkdate],"yymm"))) AS NumBookings,
(Format([bkdate],"mm")) AS [Month]
FROM dbo_tblBook
GROUP BY Format([bkdate],"mmm"), (Format([bkdate],"mm")),
Format([bkdate],"mmm yy")
HAVING (((Format([bkdate],"mmm yy")) Like "*06"))
ORDER BY (Format([bkdate],"mm"));
joined query using wizard
SELECT [06].Date, [06].NumBookings, [07].NumBookings
FROM 06 INNER JOIN 07 ON [06].Month = [07].Month;
It is this last one that gets passed through to the graph and pulls
back the exactly what i need but would like to have it so that i don't
rely on query1 or query2
I hope you can help
Marc
I am trying writing a SQL query to pass into an Chart in access. My
problem is i need to combine 2 querys together to give me the two lines
in the chart. Using the wizards this is no problem but i want to use
sql so i can pass variables into the query to make it easily updatable
by the user.
query1 called "06"
SELECT Format([bkdate],"mmm") AS [Date],
Count((Format([bkdate],"yymm"))) AS NumBookings,
(Format([bkdate],"mm")) AS [Month]
FROM dbo_tblBook
GROUP BY Format([bkdate],"mmm"), (Format([bkdate],"mm")),
Format([bkdate],"mmm yy")
HAVING (((Format([bkdate],"mmm yy")) Like "*06"))
ORDER BY (Format([bkdate],"mm"));
query2 called "07"
SELECT Format([bkdate],"mmm") AS [Date],
Count((Format([bkdate],"yymm"))) AS NumBookings,
(Format([bkdate],"mm")) AS [Month]
FROM dbo_tblBook
GROUP BY Format([bkdate],"mmm"), (Format([bkdate],"mm")),
Format([bkdate],"mmm yy")
HAVING (((Format([bkdate],"mmm yy")) Like "*06"))
ORDER BY (Format([bkdate],"mm"));
joined query using wizard
SELECT [06].Date, [06].NumBookings, [07].NumBookings
FROM 06 INNER JOIN 07 ON [06].Month = [07].Month;
It is this last one that gets passed through to the graph and pulls
back the exactly what i need but would like to have it so that i don't
rely on query1 or query2
I hope you can help
Marc