sql question

From: zamba <CRISTIAN_FERRERO_at_hotmail.com>
Date: Fri, 30 May 2008 11:58:24 -0700 (PDT)
Message-ID: <f11b90cb-b7a9-49e9-99a5-b905bfb18036@m45g2000hsb.googlegroups.com>


Hi..i have this trouble ....

i have table A wich this data

cod_group           bill_type
   GROUPA          BILLTYPE1
   GROUPA          BILLTYPE2
   GROUPB         BILLTYPE1
   GROUPC         BILLTYPE2
   GROUPC         BILLTYPE3

THEN i have 3 tables

TABLE NOTICE wich have this field : notice_number

TABLE NOTICE_BILLS wich have notice_number , bill_number

TABLE BILLS wich have bill_number , bill_type

i wish to get all the NOTICE wich have exactly the same bill type in its bills that the group i send as parameter.If group have 2 types, notice must have 2 bills with the same code, if group have 1 type, notice must have 1 bill with this type

example

NOTICE 1
    BILL100 (BILLTYPE1)
    BILL200(BILLTYPE3) IF I SEND PARAMETER GROUPA , GROUPB OR GROUPC NO ROWS MUST RETURN because the combination doesn't exist in any group

if ihave

NOTICE2
 BILL300(BILLTYPE1)

IF I SEND GROUPA         , no rows must return, because group a have
BILLTYPE1 AND BILLTYPE2, but if i send GROUPB         , must return a
value,

thanks !!!!!! Received on Fri May 30 2008 - 13:58:24 CDT

Original text of this message