&nbsp;<BR>Hi,<BR><BR>I need a bigger brain than my own to wrap around this. I&#039;ll try to articulate it well:<BR><BR>I am designing a subscription based site which allows members to search for events to attend. In order to attend, however, they must "RSVP" to the event online.<BR><BR>Thus, I have 3 tables... a "users" table which contains user_id and all user fields, an "events" table with event_id and all event fields, and an "rsvp" table which is simply a matrix of user_id and event_id. There is only ever a single instance of any given user_id:event_id pair. That part is all done.<BR><BR>My Goal:<BR><BR>I have a search form which allows members to search for events and display the results in a datagrid. If a member has already RSVPd to a given event... I&#039;d like that event to have some kind of graphical icon in the first column of the datagrid which conveys "you have already RSVPd to this event", so they know to not look at it again. Optionally.... I might even like to be able to display only events to which they have not yet RSVPd.<BR><BR>The former is more difficult since I need to mix both RSVPd and non-RSVPd events in one grid, and be able to differentiate the two with a graphical icon. I suspect the latter example might more easily be achieved by using some kind of join.<BR><BR>My Question:<BR><BR>I&#039;m passing user_id to the SQL "get_events_sp" stored proc... do I need to use a cursor in the SP to accomplish this, or is there some kind of fancy join technique I&#039;m not aware of?<BR><BR>My initial thinking is that I&#039;d have to create a cursor in the SP which iterates through the events_tb, and with each event_id performs a sub-query such as:<BR><BR>open cursor as (select event_id from event_tb) into @event<BR>fetch next, etc<BR> select count(*) from rsvp_tb where user_id = @user AND event_id = @event AS in_rsvp<BR>close cursor<BR><BR>Basically with that approach I&#039;d append the desired data PLUS a virtual field containing 1 or 0 as "in_rsvp" to a new table and return that. Then I&#039;d bind the "in_rsvp" field to a template column of the datagrid (containing an image control) and format it by appending .gif in order to display the appropriate icon 1.gif or 0.gif (which is blank).<BR><BR>I guess the question boils down to: "is there any way to build a sub-query within a set based main query which utilizes a field from the main query so I don&#039;t have to use an iterative cursor?" I&#039;m thinking maybe one of those @@WHATEVER things might allow for this?<BR><BR>Enlighten me.........<BR><BR>Thanks,<BR>Bryan