Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 loops

Author  Topic 

alancarl07
Starting Member

3 Posts

Posted - 2002-01-23 : 03:20:55
Below, is a sample code for my query.

SELECT tblEvents.AreaCodeID, tblEventTypeID.Order
FROM tblEventTypeID, tblEvents
WHERE (((tblEventTypeID.EventTypeID)=[tblEvents].[EventTypeID]) AND ((tblEvents.AreaCodeID) In (SELECT DISTINCT AreaCodeID FROM tblEvents))) ORDER BY tblEvents.AreaCodeID;

the higlighted test returns a list of areacodeID's. I need to know someway of seprating them.. to perform the query as if we are hardcoding the value

for example : WHERE (((tblEventTypeID.EventTypeID)=[tblEvents].[EventTypeID]) AND ((tblEvents.AreaCodeID) = {1,2,3} ORDER BY tblEvents.AreaCodeID;

so it has perform the operation in a loop format


any suggestions...

end result is to make a report

Nazim
A custom title

1408 Posts

Posted - 2002-01-23 : 08:11:55
you can put the AreaCode values in a seperate tables and use the same query

SELECT tblEvents.AreaCodeID, tblEventTypeID.Order
FROM tblEventTypeID, tblEvents
WHERE (((tblEventTypeID.EventTypeID)=[tblEvents].[EventTypeID]) AND ((tblEvents.AreaCodeID) In (
SELECT DISTINCT AreaCodeID FROM newtable
))) ORDER BY tblEvents.AreaCodeID;



--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page
   

- Advertisement -