Avatar of jaymz69
jaymz69

asked on 

Get the date in the Report

Since I am doing a GROUP BY user

I always get the error
"Column 'OPENQUERY.PCHDATE' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."

All I really need is the Date of the transaction from the SELECT

I tell the select to CURRENT_DATE - DAYS -- AS400 SQL

is there a way to pass it on to the subscription text in the email?
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
tigin44
Avatar of tigin44
tigin44
Flag of Türkiye image

could you post your query...
Avatar of jaymz69
jaymz69

ASKER


SELECT pchpuser 'User',
	COUNT(*) 'Total Lines Counted by User',
	pchdate 'dt'

FROM OPENQUERY (MyData, '
SELECT *
FROM picounthst
WHERE pchloc = 41
	AND pchdate = (CURRENT_DATE - 1 DAYS)
')

GROUP BY pchpuser ;

-- The subribed report form SSRS will have the User and count but
-- I also want the date from wne the transaction happenedsomewhere...
-- or atleats the value from the CURRENT_DATE - 1 DAYS

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of tigin44
tigin44
Flag of Türkiye image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft SQL Server 2008
Microsoft SQL Server 2008

Microsoft SQL Server 2008 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. Major improvements include the Always On technologies and support for unstructured data types.

50K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo