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
Crystal Report and multiple datatables merge problem
Dec 6 2012 3:09 PM
Hi,
I have these two select queries and I used them for making a new select in access. The first two queries I used for filling the two datatables in dataset. I want to use the third, the derived query for filling the CrystalReport.
1. Here is the first query:
SELECT MAGACIN.GBR, MAGACIN.DATA, NOVI.AB, Max(IIf([sifra]='0992201',[kol],Null)) AS Addblue, Max(IIf([sifra]='0999001',[kol],Null)) AS Antifriz, Max(IIf([sifra]='0991000',[kol],Null)) AS Gorivo, Max(IIf([sifra]='0993050',[kol],Null)) AS Motmaslo
FROM MAGACIN INNER JOIN NOVI ON MAGACIN.GBR = NOVI.GBR
GROUP BY MAGACIN.GBR, MAGACIN.DATA, NOVI.AB
HAVING (((MAGACIN.GBR)=[@gbr1]) AND ((MAGACIN.DATA)>=[data1] And (MAGACIN.DATA)<=[data2]) AND ((NOVI.AB)=[@ab1] Or (NOVI.AB)=[@ab2]))
ORDER BY MAGACIN.DATA;
2. The second query:
SELECT NALOG1.GBRV, NALOG1.DATA, Min(IIf([NALOG1.GBRV]=[@gbr1] And ((NOVI.AB)=[@ab1] Or (NOVI.AB)=[@ab2]) And [NALOG1].[POCKM]>0,[NALOG1.POCKM],Null)) AS pockm, Max(IIf([NALOG1.GBRV]=[@gbr1] And ((NOVI.AB)=[@ab1] Or (NOVI.AB)=[@ab2]) And ([NALOG1.DATA]>=[@data1]) And ([NALOG1.DATA]<=[@data2]),[NALOG1.KRAJKM],Null)) AS krajkm, Max(NOVI.DATAP) AS Poslprov, Max(NOVI.DATAS) AS Poslserv, Sum(NALOG1.km) AS sumkm, Max(NOVI.KMP1) AS KMP, Max(NOVI.KMS1) AS KMS
FROM NALOG1 INNER JOIN NOVI ON NALOG1.GBRV = NOVI.GBR
WHERE (((NALOG1.GBRV)>=[@gbr1]) AND ((NOVI.AB)=[@ab1] Or (NOVI.AB)=[@ab2]))
GROUP BY NALOG1.GBRV, NALOG1.DATA, NOVI.KMP1, NOVI.KMP2, NOVI.KMS1, NOVI.KMS2
HAVING (((NALOG1.GBRV)=[@gbr1]) AND ((NALOG1.DATA)>=[@data1] And (NALOG1.DATA)<=[@data2]));
and I create this query (which works in access) which uses the first and the second query for filling the crystalreport
SELECT NalogNov1.DATA, Max(IIf([MagNov1].[DATA]=[NalogNov1].[DATA],[MagNov1].[Gorivo],0)) AS Gorivo1, Max(IIf([MagNov1].[DATA]=[NalogNov1].[DATA],[MagNov1].[Addblue],0)) AS Addblue1, Max(IIf([MagNov1].[DATA]=[NalogNov1].[DATA],[MagNov1].[Antifriz],0)) AS Antifriz1, Max((IIf([MagNov1].[DATA]=[NalogNov1].[DATA],[MagNov1].[Motmaslo],0))) AS Motmaslo1, Min(NalogNov1.pockm) AS MinOfpockm, Max(NalogNov1.krajkm) AS MaxOfkrajkm, [krajkm]-[pockm] AS RAZLIKA, NalogNov1.Poslprov, NalogNov1.Poslserv, NalogNov1.KMS, NalogNov1.KMP
FROM NalogNov1 LEFT JOIN MagNov1 ON NalogNov1.GBRV = MagNov1.GBR
WHERE (((NalogNov1.GBRV)=[MagNov1].[GBR]))
GROUP BY NalogNov1.DATA, [krajkm]-[pockm], NalogNov1.Poslprov, NalogNov1.Poslserv, NalogNov1.KMS, NalogNov1.KMP
ORDER BY NalogNov1.DATA;
But I don't know how to use this in C# for combining the both datatables from the dataset and to get the same result as in access. Can anybody help me please?
thanks
Reply
Answers (
2
)
Microsoft is turning into an open source company
Can anyone please send me list of companies dealing in ASP.NET with C# projects in Mumbai.?