Lucas
Lucas

Reputation: 6729

Get my friends' facebook events

My results aren't logical. I get only one event when querying for the following

SELECT name, venue, location, start_time, eid FROM event 
WHERE eid IN (
       SELECT eid FROM event_member 
       WHERE (uid IN (SELECT uid2 FROM friend WHERE uid1 = me())  OR uid = me())
   )
AND start_time > now()
AND venue.latitude  < '-22.821757'
AND venue.latitude  > '-23.056989'

Result:

{
  "data": [
    {
      "name": "Beijaço de recepção ao Papa Bento XVI", 
      "venue": {
        "street": "", 
        "city": "", 
        "state": "", 
        "country": "", 
        "latitude": -22.97444595952, 
        "longitude": -43.187243996668, 
        "id": 152289418168750
      }, 
      "location": "Praia Copacabana - Rio de Janeiro - Brasil", 
      "start_time": "2013-07-23T14:00:00", 
      "eid": 304646919571378
    }
  ]
}

but if I delete the last line, setting only one of the latitude's limits, I get a bunch of results, including some that should definitely display on the complete query like:

{
  "name": "Wobble apresenta: RUIDO", 
  "venue": {
    "id": 245734958851552
  }, 
  "location": "00 Rio de Janeiro", 
  "start_time": "2013-02-15T22:00:00-0200", 
  "eid": 132007820298359
}, 

which venue's got "latitude": -22.978986942704

Is that a bug or am I doing something wrong?

http://itouchmap.com/latlong.html - To check your latitude if you wanna test with your account

https://developers.facebook.com/tools/explorer/ - Facebook's Graph API explorer

Upvotes: 1

Views: 364

Answers (1)

Tarek Ayna
Tarek Ayna

Reputation: 350

You are comparing the strings and not the numbers.

-22     > -23     = true
'-22'   > '-23'   = false
-22.9   < -22.8   = true
'-22.9' < '-22.8' = false

Upvotes: 1

Related Questions