Thank you Nandesh.
I tried a similar query and that gives me only one row, the problem is that it gives me the row without any values in the balance.
SELECT
gle.[Posting Date] AS PostingDate
, gle.[G_L Account No_] AS GL_AccountNumber
, gle.[Document No_] AS DocumentNumber
, ve.[Item No_] AS ItemNumber
, SUM(gle.Amount) GL_Balance
, SUM(ve.[Item Ledger Entry Quantity]) AS Quantity
, SUM(ve.[Cost Amount (Actual)]) + SUM(ve.[Cost Amount (Expected)]) AS Cost
, SUM(ve.[Cost Amount (Actual)] + ve.[Cost Amount (Expected)]) / NULLIF(SUM(ve.[Item Ledger Entry Quantity]), 0) AS UnitCost
FROM
NAV.dbo.[G_L Entry] gle
INNER JOIN NAV.[dbo].[G_L - Item Ledger Relation] rel
ON gle.[Entry No_] = rel.[G_L Entry No_]
INNER JOIN NAV.dbo.[Value Entry] ve
ON rel.[Value Entry No_] = ve.[Entry No_]
WHERE
gle.[G_L Account No_] IN (‘13110’) AND
gle.[Posting Date] BETWEEN ‘1753-01-01 00:00:00’ AND ‘2013-11-23 00:00:00’ AND
gle.[Document No_] = ‘SPI03115’
GROUP BY
gle.[Posting Date]
, gle.[G_L Account No_]
, gle.[Document No_]
, ve.[Item No_]
2010-05-25 00:00:00.000 13110 SPI03115 10828 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 NULL
and I know that the other row (second row), does contain a gl balance value. I do not know how to force the single row to be returned to be the one with a gl balnce value.
Look at the first example I shared.
Thank you so much for your help.