MySQL Query with multiple Params

Hey guys,

Quick question.

If i have a select statement like:

“SELECT * FROM Orders WHERE (id = ?) OR (cost = ?)”

Is there a way for bubble to allow the same input to be applied to each parameter? It seems that i cant - so even if i want to apply the same parameter in multiple spots in the query, i need to define it multiple times in my workflow.

Thanks!

There’s a 1 to 1 relationship between ?'s and parameters. Meaning, if you have 2 ?'s, you need 2 parameters, 3 ?'s you need 3 parameters, etc. Then, when you invoke the query, you will be prompted to send a value to each parameter. You can use the same bubble value for multiple parameters, but each value must be filled in. For example, if you have a query such as:

select * from past_orders where customer_id=?
union
select * from open_orders where customer_id=?
order by order_date desc limit 200;

You would have 2 parameters, both for the customer_id. Name one of the parameters “cust_id1” and the other parameter “cust_id2”. Then you can use the same Bubble value for each parameter. But there’s no getting around having 2 separate parameters in this example. Hope that helps!

Yep - that’s what I thought (and how i have it) was just hoping for a secret I was unawares of!

Thanks