Hello:
I have a MYSQL database connected to a website where users log in, and name cities that they will travel to in the near future. They can name up to 10 cities nationwide. I take their list of cities and then query a coupon table where coupons are available according to a geographic location.
My question: Is there an easy way to name a group of elements and then do an sql query for any element in the group.
For example MyCityGroup = {'New York', 'Chicago', 'Denver', 'LA'};
And I would like to say something like this:
SELECT * from coupon_table WHERE city IS AN ELEMENT OF MyCityGroup;
Is this possible, or do I have to do the long form:
SELECT * from coupon_table
WHERE city='New York'
OR city='Chicago'
OR city='Denver'
OR city='LA';
Looking for a shortcut if there is one.
Thanks in advance, and I look forward to contributing to this forum.