I have a table that contains user and station information, as well as a boolean 
field for whether the information is displayed or not.

It looks roughly like this:

uStationID
userID_fk
stationID_fk
checked

I have another very similar table that looks like this

cStationID
customerID_fk
stationID_fk
checked

On my pages I have two select boxes.  The first select box is populated by a 
query that gets all the values by the userID_fk field whose value is passed 
when the user is logged in and which have the value of "checked".

Somehow, I need to populate the second select with values from the second table 
that returns only those records from the second table that match the 
stationID_fk and checked of the first query, as well as are constrained by the 
"checked" field in the second query.

As an illustration, say that users table has the following entries:

userID_fk     [1]
stationID_fk  [1]
checked       [0]

userID_fk     [1]
stationID_fk  [2]
checked       [1]

userID_fk     [1]
stationID_fk  [3]
checked       [0]

userID_fk     [1]
stationID_fk  [4]
checked       [0]

So here, the query will return only the value of the second and forth row.

Now, I need to get the rows from the customers table that match the value of 
these row (and any other rows that are returned).

customerID_fk [1]
stationID_fk  [1]
checked       [0]

customerID_fk [1]
stationID_fk  [2]
checked       [1]

customerID_fk [1]
stationID_fk  [3]
checked       [1]

customerID_fk [1]
stationID_fk  [4]
checked       [0]

Here, the 2nd and 3rd rows are both checked, but I only want the second row to 
return since the first query contains a matching value.

Does anyone have any idea how I could get this to work, or is there a better 
way to set up my database to accomplish this?  

I started off with lists for each, but that wasn't working either.

Thanks in advance for the help.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283688
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to