Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. SELECT SQL_CALC_FOUND_ROWS R.RestaurantID AS RestaurantID,
  2. R.Title AS Title, R.Description AS Description, R.WorkHour AS WorkHour,
  3. R.ActualText AS ActualText, R.OfferText AS OfferText, R.CordinateX AS CordinateX, R.CordinateY AS CordinateY,
  4. R.Logo AS Logo, R.Phone AS Phone, R.Email AS Email, R.Website AS Website, R.Address AS Address,
  5. R.Postage AS Postage, R.City AS City, R.Options AS Options, R.RestaurantCategoryID AS RestaurantCategoryID,
  6. S.Paid AS Paid, (3959 * ACOS(COS(RADIANS(45.9589980)) * COS(RADIANS(CordinateX)) * COS(RADIANS(R.CordinateY) - RADIANS(15.4921310)) + SIN (RADIANS(45.9589980)) * SIN(RADIANS(R.CordinateX)))) AS Distance,
  7. IF(RL.RestaurantID IS NULL, FALSE, TRUE) as LunchActive FROM Restaurant R JOIN RestaurantCategory RC ON (R.RestaurantCategoryID = RC.RestaurantCategoryID)
  8. JOIN Subscription S ON (R.RestaurantID = S.RestaurantID)
  9. LEFT JOIN RestaurantLunch AS RL ON R.RestaurantID = RL.RestaurantID
  10. WHERE R.Status = 1 AND MATCH (R.Title, R.Description, R.City, R.Address, R.ActualText, R.OfferText, RL.Text) AGAINST ('maribor čevapčiči' IN BOOLEAN MODE) GROUP BY R.RestaurantID
  11. HAVING Distance < 100 ORDER BY Distance ASC, R.Title ASC LIMIT 1000;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement