Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing only the first vendor code (not all) associated with user

Status
Not open for further replies.

gautammalkani

Technical User
Sep 29, 2003
51
US
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')
 
Your SQL code is not JetSQL.
You may get better results asking in your DBMs's forum.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top