MySQL Forums
Forum List  »  Newbie

Query for finding keys (IDs) that only have one of two values associated with it
Posted by: Sean Griffin
Date: April 17, 2014 08:16AM

Hi. I'm a complete newbie with MySQL and need some help creating a query. What I'to do is:
For any post_id that has a _VenueVenue but does NOT have a _VenueLat, return the post_id.

So using my example table below, the query would return 21348 and 21354, because those post_id's have a _VenueVenue (in the meta_key column), but do not have a _VenueLat.

Any assistance would be greatly appreciated.

Thanks,
Sean

meta_id post_id meta_key meta_value
295290 21302 _VenueVenue Wilson State Park Campground
295310 21302 _VenueLat 44.0309908
295882 21348 _VenueVenue Flatbread Company
295938 21354 _VenueVenue Tuck School of Business at Dartmouth College
295206 21296 _VenueVenue Rosewood Park
295226 21296 _VenueLat 42.8962559

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.