I am trying to build a dynamic query.
This works fine :
$qstring="10000, 10001, 10003, 10005";
SELECT *
FROM orders
WHERE order_id in ($qstring);
This also works fine when I have no data to match and select.
$qstring="";
SELECT *
FROM orders
WHERE order_id in ($qstring);
Does something like below exists to match any data? I checked out the pattern matching for SQL but found nothing that could match everything.
$qstring="*";
SELECT *
FROM orders
WHERE order_id in ($qstring);
Any hints? Thanks!
If you want to match everything just use the select without the where clause.
If you’re forced (for some odd reason to use the construct you described) then…