cancel
Showing results for 
Search instead for 
Did you mean: 

Query Issue

amol_bairagi
Participant
0 Kudos

Dear Experts,

I have an issue in the below query, I want to display single value in DocumentTotal field (Row Level) (not repeated value). Kindly provide the solution for that.

SELECT T4.[SeriesName], T0.[DocNum] as 'A/R Invoice', T0.[DocDate] as 'Inv. Date', T0.[CardName] as 'Customer Name', T0.[NumAtCard] as 'Bill No. & Date',  T1.[LineTotal] as 'Sales Amount', T1.[GTotal] as 'Total Sales', t0.doctotal FROM [dbo].[OINV]  T0 INNER JOIN [dbo].[INV1]  T1 ON T0.DocEntry = T1.DocEntry INNER JOIN [dbo].[NNM1]  T4 ON T0.Series = T4.Series

WHERE T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1] AND  T4.[SeriesName] =[%3]

#

Series Name

A/R Invoice

  1. Inv. Date

Customer Name

Bill No. & Date

Total Sales

Document Total

1

BADDI

1004

12/4/2014

ABC CO

ABC/001

172,592.55

2,123,173.00

2

BADDI

1004

12/4/2014

ABC CO

ABC/001

1,994,908.50

2,123,173.00

Regards

Amol

Accepted Solutions (1)

Accepted Solutions (1)

amol_bairagi
Participant
0 Kudos

Thanks Nagarajan

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

If you got answer, please close this thread by marking correct answer.

Thanks & Regards,

Nagarajan

Answers (2)

Answers (2)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this query:

SELECT T4.[SeriesName], T0.[DocNum] as 'A/R Invoice', T0.[DocDate] as 'Inv. Date', T0.[CardName] as 'Customer Name', T0.[NumAtCard] as 'Bill No. & Date',  sum(T1.[LineTotal]) as 'Sales Amount', sum(T1.[GTotal]) as 'Total Sales', t0.doctotal FROM [dbo].[OINV]  T0 INNER JOIN [dbo].[INV1]  T1 ON T0.DocEntry = T1.DocEntry INNER JOIN [dbo].[NNM1]  T4 ON T0.Series = T4.Series

WHERE T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1] AND  T4.[SeriesName] =[%3] group by  T4.[SeriesName], T0.[DocNum],T0.[DocDate],T0.[CardName],T0.[NumAtCard],t0.doctotal

Thanks & Regards,

Nagarajan

former_member186712
Active Contributor
0 Kudos

Hi Amol,

Write

SELECT Distinct T4.[SeriesName], T0.[DocNum] as 'A/R Invoice', T0.[DocDate] as 'Inv. Date', T0.[CardName] as 'Customer Name', T0.[NumAtCard] as 'Bill No. & Date',  T1.[LineTotal] as 'Sales Amount', T1.[GTotal] as 'Total Sales', t0.doctotal FROM [dbo].[OINV]  T0 INNER JOIN [dbo].[INV1]  T1 ON T0.DocEntry = T1.DocEntry INNER JOIN [dbo].[NNM1]  T4 ON T0.Series = T4.Series

WHERE T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1] AND  T4.[SeriesName] =[%3]

Hope it helps