cancel
Showing results for 
Search instead for 
Did you mean: 

need some help with a sql query

Former Member
0 Kudos

Hello how can give me some help making a query?

Ik want to have a table to do a check if a wrong Vat code is used on a transaction

so i need to have:

Vatcode chartoff acount vat amont amont vat date

A2 8010 19 100 010405

this what I did:

SELECT T0.TransId, T0.ShortName, T1.Code,T1.Rate,T0.Debit, T0.Credit,T0.VatAmount, T0.SYSVatSum FROM JDT1 T0, OVTG T1 WHERE T0.Account=8010

who can give me some help?

thanks Jacques

jd@comm-co.com

Accepted Solutions (1)

Accepted Solutions (1)

AlexGrebennikov
Active Contributor
0 Kudos

Hi!

i suppose that is you are lookin' for:

SELECT 
	T0.TransId, 
	T0.ShortName, 
	T1.Code,
	T1.Rate,
	T0.Debit, 
	T0.Credit,
	(T0.Debit-T0.Credit)*T1.Rate/100,
	(T0.SysDeb-T0.SysCred)*T1.Rate/100
FROM 
	JDT1 T0
	LEFT JOIN OVTG T1 ON
		T1.Code = T0.VatGroup
WHERE 
	T0.Account = N'xxx'

Answers (0)