mysql query multiple records for one field

Hello Group,

What I have is a database with about a dozen fields and one being "City".

What I would like to do is to have a custom query on a single field for multiple items (cities) but I don't know how to do this. I know this is probably kids play for most of you but I am lost. What I have got to work is a single city from the list but I do not know how to "ADD", "OR" or what I need to do next to add a second city so the results displayed contain both cities.

What I have so far is this:

SELECT MyList.`Filed Date` AS `Filed Date`,
  MyList.City AS City,
  MyList.State AS State,
  MyList.`Zip Code` AS `Zip Code`,
  MyList.Street AS Street,
  MyList.Owner AS Owner
FROM MyList
WHERE MyList.City = _latin1'Buffalo'

Not sure what to add to the WHERE to add more city names other than "Buffalo" to the "City" field.:wall:

Thanks in advance for any replies!

Art

SELECT MyList.`Filed Date` AS `Filed Date`,
  MyList.City AS City,
  MyList.State AS State,
  MyList.`Zip Code` AS `Zip Code`,
  MyList.Street AS Street,
  MyList.Owner AS Owner
FROM MyList
WHERE MyList.City in ( 
  a_comma_separated_list_of_values_here
  );
1 Like

radoulov,

Thank you!

That works fine. Is there any way to specify a sort order as the output I get is mixed together in random order or using another column to sort between all cities I specify. If not that is fine but having all the ducks in a row would be best.

Thanks again!

Art

Just add an order by clause:

...
WHERE MyList.City in ( 
  a_comma_separated_list_of_values_here
  )
order by 
  MyList.City (or some other column or expression)
1 Like

Sorry for the questions. I know this is basic stuff. I use RAD software for development and doing anything extra like this is off the wall for me.

Thank you once again!

Art:)