TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nel
NA
716
1.1m
how to use aggregate functions when combining two datatables
Dec 7 2012 3:32 AM
Hi,
I have two datatables in the dataset and I want to use the fields from both datatables to create a Crystal Report. But I use max and group by in the select query which when I run in access works fine. But, I don't know how to combine the datatables using aggregate functions.
I have two datatables:NalogNov and MagNov and the result query I made is:
SELECT NalogNov.DATA, Max(IIf([MagNov].[DATA]=[NalogNov].[DATA],[MagNov].[Gorivo],0)) AS Gorivo1, Max(IIf([MagNov].[DATA]=[NalogNov].[DATA],[MagNov].[Addblue],0)) AS Addblue1, Max(IIf([MagNov].[DATA]=[NalogNov].[DATA],[MagNov].[Antifriz],0)) AS Antifriz1, Max(IIf([MagNov].[DATA]=[NalogNov].[DATA],[MagNov].[Motmaslo],0)) AS Motmaslo1, NalogNov.pockm, NalogNov.krajkm, [krajkm]-[pockm] AS RAZLIKA, Max(NalogNov.Poslprov) AS MaxOfPoslprov, Max(NalogNov.Poslserv) AS MaxOfPoslserv, Max(NalogNov.KMS) AS MaxOfKMS, Max(NalogNov.KMP) AS MaxOfKMP
FROM NalogNov LEFT JOIN MagNov ON NalogNov.GBRV = MagNov.GBR
WHERE (((MagNov.GBR)=[NalogNov].[GBRV]))
GROUP BY NalogNov.DATA, NalogNov.pockm, NalogNov.krajkm, [krajkm]-[pockm]
ORDER BY NalogNov.DATA;
But how to use this query in C# creating the CrystalReport? I tried to use the CR wizard, but I have lot of rows for one data, and the values in the result CR are not correct. Can anybody help me please?Thanks
Reply
Answers (
5
)
Making number guessing game object oriented
cursor symbol on datagrid view