Subject | SQL question |
---|---|
Author | Burak OZLER |
Post date | 2001-12-06T08:41:06Z |
Hi All..
I'm using double fielded indexes at my database becouse of replication purposes. At the sql statement below I'm trying to retreive the CARI_GRUP_ID,CARI_GRUP_SID, CGKOD, CGADI
from CARI_GRUP where the given CARI_ID and CARI_SID doesn't belong to the CARI_GRUP_UYE
-----------------------------
CARI_GRUP TABLE
-------------------------------
* CARI_GRUP_ID
* CARI_GRUP_SID
CGKOD
CGADI
CGACK
TIP
--------------------------------------
CARI_GRUP_UYE TABLE
-------------------------------------
*CARI_GRUP_ID
*CARI_GRUP_SID
*CARIID
*CARI_SID
VARSAY
--------------------------
* - Primary key fields
Select CARI_GRUP_ID,CARI_GRUP_SID, CGKOD, CGADI
From CARI_GRUP
Where CARI_GRUP_ID Not In(Select CARI_GRUP_ID
From CARI_GRUP_UYE
Where CARIID=:PRM_CARI_ID And CARI_SID=:PRM_CARI_SID)
and CARI_GRUP_SID Not In(Select CARI_GRUP_SID
From CARI_GRUP_UYE
Where CARIID=:PRM_CARI_ID And CARI_SID=:PRM_CARI_SID)
The statement above must work right, but I feel that there must be a better and more reliable way to do it.
Any ideas?
Thanks
Burak
[Non-text portions of this message have been removed]
I'm using double fielded indexes at my database becouse of replication purposes. At the sql statement below I'm trying to retreive the CARI_GRUP_ID,CARI_GRUP_SID, CGKOD, CGADI
from CARI_GRUP where the given CARI_ID and CARI_SID doesn't belong to the CARI_GRUP_UYE
-----------------------------
CARI_GRUP TABLE
-------------------------------
* CARI_GRUP_ID
* CARI_GRUP_SID
CGKOD
CGADI
CGACK
TIP
--------------------------------------
CARI_GRUP_UYE TABLE
-------------------------------------
*CARI_GRUP_ID
*CARI_GRUP_SID
*CARIID
*CARI_SID
VARSAY
--------------------------
* - Primary key fields
Select CARI_GRUP_ID,CARI_GRUP_SID, CGKOD, CGADI
From CARI_GRUP
Where CARI_GRUP_ID Not In(Select CARI_GRUP_ID
From CARI_GRUP_UYE
Where CARIID=:PRM_CARI_ID And CARI_SID=:PRM_CARI_SID)
and CARI_GRUP_SID Not In(Select CARI_GRUP_SID
From CARI_GRUP_UYE
Where CARIID=:PRM_CARI_ID And CARI_SID=:PRM_CARI_SID)
The statement above must work right, but I feel that there must be a better and more reliable way to do it.
Any ideas?
Thanks
Burak
[Non-text portions of this message have been removed]