SQL: select SQL_CALC_FOUND_ROWS persons.postdate, persons.id, persons.title, persons.city, worldregions.region, worldcountries.country, worldregions.countryid, worldregions.regionid, persons.usertypeid, persons.pref_usertypeids, persons.photo, persons.year, persons.bid, persons.email, persons.interests, persons.lastloginunixtimestamp, persons.movies, persons.musicbands, persons.nickname, timediff(NOW(), FROM_UNIXTIME(lastloginunixtimestamp)) as timeago, persons.languageids from persons, worldregions, worldcountries where persons.countryid = worldregions.countryid and persons.regionid = worldregions.regionid and persons.countryid = worldcountries.countryid and persons.usertypeid = orderby and persons.city = 'Ahmedabad' and persons.countryid = 'IN' and persons.regionid = '09' order by persons.bid desc, persons.hasphoto desc, persons.lastloginunixtimestamp desc, persons.id desc limit 0, 10