on 2024 Dec 23 2:00 PM
Hi everyone, thanks for all the help you are giving, no doubt you guys are amazing.
I need your help please
I want to generate a query that shows all the revenues, all the return invoices, the salespeople and the customer group by name between certain dates
This is the query I wrote:
SELECT
T0.[DocNum],
T0.[DocDate],
T0.[CardCode],
T0.[CardName],
T0.[DocTotal],
T2.[GroupName],
CASE
WHEN T0.[DocType] = 'I' THEN 'Invoice'
WHEN T0.[DocType] = 'R' THEN 'Refund'
ELSE 'Other'
END AS DocumentType
FROM
(
SELECT *,'I' as DocType FROM OINV
UNION ALL
SELECT *,'R' as DocType FROM ORIN
) AS T0
INNER JOIN OCRD T2 ON T0.[CardCode] = T2.[CardCode]
INNER JOIN OCRG T3 ON T2.[GroupCode] = T3.[GroupCode]
WHERE
T0.[DocDate] BETWEEN [%0] AND [%1]
AND T2.[GroupCode] = [%2]
And this is the error i get:
1). [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Must specify table to select from. 2). [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Statement 'התראות שנתקבלו' (OAIB) (s) could not be prepared.
please help me solve it
Request clarification before answering.
| User | Count |
|---|---|
| 15 | |
| 11 | |
| 10 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.