Question
If statement in the SELECT???
I use Coldfusion as my source for remoting with Flash. I have
created different databases for different materials. However when
an order is placed I get the "id" of the material. I also return
the "type" of material. If I would have planned this correctly I
would have just put all the materials in one database and returned
what I needed just fine. As it turns out I cannot change it.
Below is my code and basically what I'd like to do is say that:
if bag_traits.trait_type = 1
select materials.material_name where bag_orders.bag_trait_a = materials.material_id
So right now it's returning a 6. I need the name of the material from the materials database with an id of 6. I also have a ribbons table where if the trait_type = 2 then I would need the ribbons.ribbon_name where bag_orders.bag_trait_a = ribbons.ribbon_id.
How to I make an if or case statement that will pull the name from the appropriate database depending on the trait_type? Thanks!
Below is my code and basically what I'd like to do is say that:
if bag_traits.trait_type = 1
select materials.material_name where bag_orders.bag_trait_a = materials.material_id
So right now it's returning a 6. I need the name of the material from the materials database with an id of 6. I also have a ribbons table where if the trait_type = 2 then I would need the ribbons.ribbon_name where bag_orders.bag_trait_a = ribbons.ribbon_id.
How to I make an if or case statement that will pull the name from the appropriate database depending on the trait_type? Thanks!
