I'm currently running a crosstab query that displays the total amounts of Appointments that each Consultant.
Currently it is Consultant ID as the Rows, and Appointment Date as the top headings, grouped by Date (rather than month etc.)
But it is giving me a random order of dates going up numerically by day and no more.
Is there any way of giving an order to the Date columns or specifying that is should be for the next 7 days etc? here is the SQL Script -
TRANSFORM Count(Appointment.[Appointment Number]) AS [CountOfAppointment Number]
-
SELECT Appointment.[Consultant ID], Count(Appointment.[Appointment Number]) AS [Total Of Appointment Number]
-
FROM Appointment
-
WHERE (((Format([Appointment Date],"Short Date")) Between Date() And (Date()+7)))
-
GROUP BY Appointment.[Consultant ID]
-
PIVOT Format([Appointment Date],"Short Date");
-
4 2318
I'm currently running a crosstab query that displays the total amounts of Appointments that each Consultant.
Currently it is Consultant ID as the Rows, and Appointment Date as the top headings, grouped by Date (rather than month etc.)
But it is giving me a random order of dates going up numerically by day and no more.
Is there any way of giving an order to the Date columns or specifying that is should be for the next 7 days etc? here is the SQL Script -
TRANSFORM Count(Appointment.[Appointment Number]) AS [CountOfAppointment Number]
-
SELECT Appointment.[Consultant ID], Count(Appointment.[Appointment Number]) AS [Total Of Appointment Number]
-
FROM Appointment
-
WHERE (((Format([Appointment Date],"Short Date")) Between Date() And (Date()+7)))
-
GROUP BY Appointment.[Consultant ID]
-
PIVOT Format([Appointment Date],"Short Date");
-
I don't know if this will work, but it is worth a try. I'm using DateDiff to sequence the Pivot Columns. To display the sequence and the date on different lines, increase the number of spaces between the sequencer and the date in the Pivot column until the desired effect is achieved. -
TRANSFORM Count(Appointment.[Appointment Number]) AS [CountOfAppointment Number]
-
SELECT Appointment.[Consultant ID], Count(Appointment.[Appointment Number]) AS [Total Of Appointment Number]
-
FROM Appointment
-
WHERE (((Format([Appointment Date],"Short Date")) BETWEEN Date() AND (Date()+7)))
-
GROUP BY Appointment.[Consultant ID]
-
PIVOT DateDiff("d",[Date(), [Appointment Date]) & " " & Format([Appointment Date],"Short Date");
I appreciate the help puppy, and I gave your coding a shot, unfortunately it's returning similiar values, and additionally the difference is displaying as a number in the column headings. Aka " -333 17/7/2007". I've tried my hand at rearranging a few things here and there but still getting the same results.
Any more suggestions that I could try out? any feedback is greatly appreciated
I appreciate the help puppy, and I gave your coding a shot, unfortunately it's returning similiar values, and additionally the difference is displaying as a number in the column headings. Aka " -333 17/7/2007". I've tried my hand at rearranging a few things here and there but still getting the same results.
Any more suggestions that I could try out? any feedback is greatly appreciated
I just realized that the Format function outputs text strings and that is why your date is not ordering properly. All you need to do is pivot on the appointment date (unformatted as shown below) and it should be ordered propely.
PIVOT [Appointment Date];
Heh, to think something so simple was the answer. It worked perfectly puppy, thanks once again :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Donna Sabol |
last post by:
First, I should start by saying I am creating a database to be used by
some very impatient, non-computer literate people. It needs to be
seameless in it's operation from their point of view. I want them to
do as little as possible when they run their reports.
I have a crosstab query that displays usage of items for each month.
It looks pretty much like this:
ITEM DESC UM 12/02 1/03 2/03 3/03 ...ETC.
1 Solution ...
|
by: Steve Elliott |
last post by:
I have a query set up to gather together data between two specified dates.
Shown in the query column as:
Between #24/09/2004# And #01/10/2004#
Is it possible to enter several different date ranges, ie between 24/09/2004
and 01/10/2004 together with 05/10/2004 and 07/10/2004 ?
If I enter the "Between" criteria on different lines it returns no data.
|
by: mjobrien |
last post by:
i created a query with the intention of creating a columnar (9
columns) report with the 10th column as a horizontal total of the
records. i didn't think i needed a crosstab query because my first
column is just for row title constants identifying the rows on the
report. the report should look like this:
Hearing ABIs Vision Mobility etc....9th
Total
Primary Unweighted 9999 9999 9999 9999 ...........
999999
|
by: carl.barrett |
last post by:
Hi,
I'm back with the same question as I still can't get it to display
my data the way I want it to.
The table lists information about a perpetrator involved with an anti
social behaviour order. The table contains personal information about
the individual as well as (here is where the letter dates comes in:)
e.g.
|
by: Jean |
last post by:
Hello,
can the following be done?
I have a one-rowed query, with the following column headings and
values:
M-1 M-5 M-7 B-C-1 B-D-2 B-D-4 E-5 R-4
--- --- --- ----- ----- ----- --- ---
4 5 1 2 1 3 7 3
| |
by: Nenad Markovic |
last post by:
Hi everybody,
When executing a Crosstab Query I see only rows (defined in a row heading) that have values (defined in value field) in at least one column (defined as column headings). How can I make a Crosstab Query that shows all rows, regardless they have values in column headings.
For instance, the result that I get now is like this
|
by: Col |
last post by:
My table has rows that list type of pay with YTD pay for each as well
as an employee ID number. I want to make the type of pay the column
headings and have each row contain an employee id# and the YTD amount
for each type of pay. Currently each type of pay is a different records
- need the employee ID as one records with all types of pay listed.
Thoughts?
|
by: c8tz |
last post by:
This is a query I have created that picks up the top 3 dates for this
data (for example) :
Tree Pos2 Date
1 15 23/08/2005
1 20 12/02/2006
1 32 15/10/2006
2 17 23/08/2005
2 18 12/02/2006
|
by: Jim Devenish |
last post by:
I wish to create a crosstab query as the record source for a report.
It needs to count data between selected dates which are entered by the
user in a popup window.
The following Select query works:
SELECT Tasks.EnquirySourceID, Tasks.BusinessUnitID,
Count(Tasks.TaskID) AS CountOfTaskID
FROM Tasks
WHERE (((Tasks.TaskDate)>=!!))
GROUP BY Tasks.EnquirySourceID, Tasks.BusinessUnitID;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |