gautammalkani
Technical User
Hi All
I have several tables that helps me try to capture the unique number of vendors that are active from the users table as shown below in the SQL script. However, ther is an exception where users may be associated with multiple vendors. I feel that my script captures all associated vendor codes associated with my users. Is there a way of capturing only the first vendor code associated with the user. Thanks for your help.
Gautam
SQL SCRIPT:
select count(distinct(d.vendor_id))
from SSPE.PG_FORM_SUBMIT a, SSPE.SP_USER_AUX b, sspe.pg_supplier_vendor d
where a.SOURCENAME = 'wvInventoryForecast' and
a.PROFILEID = b.ID and
b.SUPPLIER_ID = d.supplier_id and
a.CLOCKTIME between to_date('15-Mar-06','DD-MON-YY') and to_date('04-Apr-06','DD-MON-YY')
I have several tables that helps me try to capture the unique number of vendors that are active from the users table as shown below in the SQL script. However, ther is an exception where users may be associated with multiple vendors. I feel that my script captures all associated vendor codes associated with my users. Is there a way of capturing only the first vendor code associated with the user. Thanks for your help.
Gautam
SQL SCRIPT:
select count(distinct(d.vendor_id))
from SSPE.PG_FORM_SUBMIT a, SSPE.SP_USER_AUX b, sspe.pg_supplier_vendor d
where a.SOURCENAME = 'wvInventoryForecast' and
a.PROFILEID = b.ID and
b.SUPPLIER_ID = d.supplier_id and
a.CLOCKTIME between to_date('15-Mar-06','DD-MON-YY') and to_date('04-Apr-06','DD-MON-YY')