Your actual result indicates that there are other rows in either of the
tables (e.g. you could have an extra row in X01 with CODSBB 3 and CANT 1).
Verify that these two queries return one row each:

SELECT *
FROM LSUBANS
WHERE CODSUB = 'SB3'

and

SELECT *
FROM X01
WHERE CODSBB = 'SB3'

HTH,
Set

2017-11-28 15:38 GMT+01:00 Laurentiu Anisie [email protected]
[firebird-support] <[email protected]>:

>
>
> I don't have null's.
>
> On Tue, Nov 28, 2017 at 4:27 PM, LtColRDSChauhan [email protected]
> [firebird-support] <[email protected]> wrote:
>
>>
>>
>> Please check if you have null values.
>> Regards,
>> Rajiv
>>
>> On 28 Nov 2017 7:05 pm, "[email protected] [firebird-support]" <
>> [email protected]> wrote:
>>
>>>
>>>
>>> Hi,
>>>
>>>
>>> I have 2 tables and I want to select some data from them based on a
>>> common records. In the query, one of the column must be calculated as
>>> product of one field from table 1 and one field from table 2.
>>>
>>> When I run the query, i get one row with the data without calculation,
>>> and one with calculation
>>>
>>>
>>> The query is this:
>>>
>>>
>>> SELECT A.CODSUB, A.CODOB, A.CODSBB, A.CANT*B.CANT FROM LSUBANS A,X01 B
>>>
>>> WHERE A.CODSUB=B.CODSBB
>>>
>>>
>>> LSUBANS
>>>
>>> CODSUB  CODOB  CODSBB  CANT
>>>
>>> SB3               EL8                         3
>>>
>>>
>>> X01
>>>
>>> CODSUB  CODOB  CODSBB  CANT
>>>
>>> SB4                            SB3             3
>>>
>>>
>>> the result of query had to be:
>>>
>>> CODSUB  CODOB  CODSBB  CANT
>>>
>>> SB3               EL8                         9
>>>
>>>
>>> instead is:
>>>
>>> CODSUB  CODOB  CODSBB  CANT
>>>
>>> SB3               EL8                         3
>>>
>>> SB3               EL8                         9
>>>
>>>
>>> What I do wrong?
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>
>
> 
>

Reply via email to