Re: [firebird-support] Select with calculated field problem

2017-11-28 Thread alauren...@gmail.com [firebird-support]
thank's. i will do that

Re: [firebird-support] Select with calculated field problem

2017-11-28 Thread Svein Erling Tysvær setys...@gmail.com [firebird-support]
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 alauren...@gmail.com
[firebird-support] :

>
>
> I don't have null's.
>
> On Tue, Nov 28, 2017 at 4:27 PM, LtColRDSChauhan rdsc1...@gmail.com
> [firebird-support]  wrote:
>
>>
>>
>> Please check if you have null values.
>> Regards,
>> Rajiv
>>
>> On 28 Nov 2017 7:05 pm, "alauren...@gmail.com [firebird-support]" <
>> firebird-support@yahoogroups.com> 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
>>>
>>> SB4SB3 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
>>>
>>>
>>>
>
>
> 
>


Re: [firebird-support] Select with calculated field problem

2017-11-28 Thread Laurentiu Anisie alauren...@gmail.com [firebird-support]
I don't have null's.

On Tue, Nov 28, 2017 at 4:27 PM, LtColRDSChauhan rdsc1...@gmail.com
[firebird-support]  wrote:

>
>
> Please check if you have null values.
> Regards,
> Rajiv
>
> On 28 Nov 2017 7:05 pm, "alauren...@gmail.com [firebird-support]" <
> firebird-support@yahoogroups.com> 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
>>
>> SB4SB3 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
>>
>>
>> 
>


[firebird-support] Select with calculated field problem

2017-11-28 Thread Рустам Муса-Ахунов rusta...@ukr.net [firebird-support]
Try this:

select
 A.CODSUB,
 A.CODOB,
 A.CODSBB,
 A.CANT*B.CANT
from LSUBANS A
join X01 B on B.CODSBB = A.CODSUB


Re: [firebird-support] Select with calculated field problem

2017-11-28 Thread LtColRDSChauhan rdsc1...@gmail.com [firebird-support]
Please check if you have null values.
Regards,
Rajiv

On 28 Nov 2017 7:05 pm, "alauren...@gmail.com [firebird-support]" <
firebird-support@yahoogroups.com> 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
>
> SB4SB3 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
>
>
> 
>


[firebird-support] Select with calculated field problem

2017-11-28 Thread alauren...@gmail.com [firebird-support]
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
 SB4SB3 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