Hey gang, any help will be apprecited. I am trying to do a simple count of all posts to a message board from a few particular users within the past 10 days.
I know the usernames and number of days that i want to query (10) and I want the output to display as follows.... Manager PostCount
user1 1
user2 14
user3 20
___________________
The query i have is but below but there is two problems with it. They are not being grouped but rather outputing lineitem AND the DATEADD criteria does not seem to affect the result. - SELECT PostAuthor, COUNT(PostAuthor) AS PM_Count
-
FROM cs_Posts
-
GROUP BY PostAuthor, PostDate
-
HAVING (PostDate = DATEADD(d, - 10, GETDATE())) AND (PostAuthor = N'dclecompte') OR
-
(PostAuthor = N'haley') OR
-
(PostAuthor = N'clapoint')
-
ORDER BY PostDate DESC, PostAuthor
I am a new guy so I really do appreciate any help that you can provide.
2 1146
TRY THIS - SELECT COUNT(PostAuthor) AS PM_Post_Count, PostAuthor
-
FROM dbo.cs_Posts
-
WHERE (PostDate = DATEADD(d, - 10, GETDATE())) OR
-
(PostAuthor = N'haley') OR
-
(PostAuthor = N'clapoint') OR
-
(PostAuthor = N'dclecompte')
-
GROUP BY PostAuthor
Hey gang, any help will be apprecited. I am trying to do a simple count of all posts to a message board from a few particular users within the past 10 days.
I know the usernames and number of days that i want to query (10) and I want the output to display as follows.... Manager PostCount
user1 1
user2 14
user3 20
___________________
The query i have is but below but there is two problems with it. They are not being grouped but rather outputing lineitem AND the DATEADD criteria does not seem to affect the result. - SELECT PostAuthor, COUNT(PostAuthor) AS PM_Count
-
FROM cs_Posts
-
GROUP BY PostAuthor, PostDate
-
HAVING (PostDate = DATEADD(d, - 10, GETDATE())) AND (PostAuthor = N'dclecompte') OR
-
(PostAuthor = N'haley') OR
-
(PostAuthor = N'clapoint')
-
ORDER BY PostDate DESC, PostAuthor
I am a new guy so I really do appreciate any help that you can provide.
TRY THIS - SELECT COUNT(PostAuthor) AS PM_Post_Count, PostAuthor
-
FROM dbo.cs_Posts
-
WHERE (PostDate = DATEADD(d, - 10, GETDATE())) OR
-
(PostAuthor = N'haley') OR
-
(PostAuthor = N'clapoint') OR
-
(PostAuthor = N'dclecompte')
-
GROUP BY PostAuthor
Is it working now or still facing an issue??
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ike |
last post by:
How can I make a query such that in the "WHERE" part of my clause, I want to
put something to the effect that, say, X days have elapsed since a given
date.
For example, suppose in my table, I have...
|
by: Mark Jerzykowski |
last post by:
Hi,
I have a log table which contains the fields log_time (DATETIME) and
session_id (VARCHAR). Using these 2 columns I want to be able to SELECT the
number of users who have been online during...
|
by: Cam Bevis |
last post by:
I'm having trouble getting my head around this, and no one in the groups
has posted exactly the problem.
The table below tracks site traffic across a network. There is 1 row
per pageview and...
|
by: calan |
last post by:
Having a brainfart....
I need a query that returns a record count, based on two distinct fields.
For example:
Order Revision Customer
001 1 Bob...
|
by: nfrodsham |
last post by:
In Microsoft's help literature, it states:
"You can filter out non-unique rows by using the DISTINCT option of an
aggregate function"
I am trying to do this in Access 2003 with the COUNT...
|
by: MLH |
last post by:
I'm tired of reading the fine print! Too many registrars out there.
So I'm asking this group for a little help.
I'm looking for a Registrar who will do an honest day's work for
a fair price. I'm...
|
by: jason.teen |
last post by:
Hi
I have this scenario:
group | id | value
---------------------------------
x | location | QLD
x | location | NSW
x | location | VIC
x | ...
|
by: LMHelper |
last post by:
Ok I am creating a new database for LM. One that will keep track of our licenses for over 400 users. We already have a database with the users information like name, location, telephone number,...
|
by: vspsdca |
last post by:
Hi,
I'm quite new to the world of VBA so any help you could extend will help me a lot with my project.
I have a database of Change Requests from our users. I have two date boxes, one is Date...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |