Subject Re: [firebird-support] SQL Help
Author Burak ÖZLER
No I Need mixed comporison of these..

I only need the result of
SUM(VALUE) 'B' <> SUM(VALUE) 'A'

Kind Regards.
Burak ÖZLER

Sanada Kolay gelsin ;o)

----- Original Message -----
From: "Tanz Anthrox" <tanz_anthrox@...>
To: <firebird-support@yahoogroups.com>
Sent: Tuesday, April 13, 2004 10:19 AM
Subject: Re: [firebird-support] SQL Help


> I could not understand the problem But, I wrote 2 SQL for you
> First
> SELECT [DISTINCT] DOCUMENT_TYPE,DOCUMENT_ID,DOCUMENT_SID,SUM(VALUE) TOPLAM
> FROM COMMON_TABLE
> GROUP BY BA
> HAVING BA ='B'
>
> Second,
> SELECT [DISTINCT] DOCUMENT_TYPE,DOCUMENT_ID,DOCUMENT_SID,SUM(VALUE) TOPLAM
> FROM COMMON_TABLE
> GROUP BY BA
> HAVING BA ='A'
>
> Let say Compare them But I think the algorithm is wrong.
> Maybe, you can explain more and give us an example
>
> Kolay gelsin.
>
Hi all,

I have a table at my application that all the modules(Documents at my
app) inserts records to this table. The documents have three filed to
determine the document at that common used table.

the identifier field's are

DOCUMNET_TYPE : INTEGER
DOCUMENT_ID : INTEGER
DOCUMENT_SID : INTEGER (this field for replication purposes to find where
this document created.

the table is lile this Let us call it common_table..

COMMON_ID : INTEGER
COMMON_SID : INTEGER
DOCUMNET_TYPE : INTEGER
DOCUMENT_ID : INTEGER
DOCUMENT_SID : INTEGER (this field for replication purposes to find where
this document is
BA : CHAR (gets only 'B' AND 'A' VALUES)
VALUE NUMERIC(18,4)

the problem is when a document inserts to this table.
must provide this.
SUM(VALUE) 'B' = SUM(VALUE) 'A'

User only pushes the post button and I insert the records about the
document. A document can insert atleast 2 records and at most 8 records to
the table. The number of records that inserted is not important. The
important think is to the record sum(Value) that have 'B' value at BA field
must be equal to the records sum(value) that have A value at BA field.

And the question..

I want to write an sql than returns me the document type,ID,SID fields
distinctly that where this equality crashes?

Any help will be very valuable..

With my best regards
Burak OZLER




Yahoo! Groups Links