SET @SQLStatement = @SQLStatement + 'SELECT * From
Employee where Employee.callNo IN (select distinct
Employee.callNo from Employee where Employee.asst_id
IN (select Assets.asst_id from Assets where bar_code =
' + char(39) + @asset + char(39) + '))'
I'll try and explain what I'm trying to do
I have two tables.
Employee and Assets
The Employee Table has two columns:
CallNo and Asst_id
The Assets table contains all the asset information, the primary key being Asst_ID.
I want to return distinct Employee records. The CallNo column in the employee table can more than one callNo with the same value.
Ex:
Employee Table:
Asst_ID CallNo
1 0BRC0000
2 0BRC0000
3 0BRC0001
I want to only return distince employee records. Hope this is making sense
>The following code is in a stored procedure. Can
>somebody please just confirm if this is a valid SQL
>Statement. I appreciate this is not a SQL Forum. I'm a
>ColdFusion developer and am trying to query the db.
>
>SET @SQLStatement = @SQLStatement + 'SELECT * From
>Employee where Employee.asstetID IN (select distinct
>Employee.callNo from Employee where Employee.asst_id
>IN (select Assets.asst_id from Assets where bar_code =
>' + char(39) + @asset + char(39) + '))'
>
>Thanks in advance
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Domains � Claim yours for only $14.70/year
>http://smallbusiness.promotions.yahoo.com/offer
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

