MySql 5, I have this product schema. There are other tables involved but this 
is the pertinent part. 

tblskus

skuid  pk
sku_prodid
more fields...

tblskuoptions

skuoptionid  pk
skuoptionname
more fields...

tblskuoptions_rel (linking many table)

skuid  fk
skuoptionid  fk


The user is presented with two dropdowns for example. 

Select color:
Select size:

I create a list based off their choices. I have a productid they submitted. 

How can I select a single sku based off the option combination they chose. I 
tried a few different things with no luck. where tblskuoptions_rel in 
(24,37,59) didnt work. It pulls too many skus. I just need the one that matches 
the combination of options they chose. It could be just size. Or just color. Or 
both. 

Here's what I have right now. This selects way too much. 

select tblskuoptions_rel.optionID, tblskus.merchskuid
from tblskuoptions_rel, tblskus
where tblskuoptions_rel.optionskuid = tblskus.skuid
and option_optionid in (<cfqueryparam cfsqltype="cf_sql_smallint" 
value="#optionSelList#" list="yes">)
and tblskus.sku_prodid = <cfqueryparam cfsqltype="cf_sql_smallint" 
value="#form.productid#">

Any help would be appreciated. 

Thanks!

Will








 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334950
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to