I'm trying to create a single query that will combine the following two queries.
SELECT 
  campgroundid, 
  ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * 
    cos( radians( lng ) - radians(-122) ) + 
    sin( radians(37) ) * sin( radians( lat ) ) ) ) 
  AS distance 
FROM campground 
HAVING distance < 25 
ORDER BY distance LIMIT 0 , 20;
SELECT * FROM campground WHERE type='private' AND wifi = 1
I tried putting them into an IN but it returned a syntax error I couldn't figure out how to fix. I tried just removing the HAVING and combining the queries, but then it says it isn't able to figure out what distance is. Any help is appreciated. Thanks.
OUTPUT: [campgroundid, name, type, wifi, distance] [1,camp ABC, private, 1, 1.34 mi] [2,camp XYZ, private, 1, 4.44 mi]
 
     
     
     
     
    