Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 0.97 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Adding column_name != 3 returns much fewer results
  2. select      scheduled_hike_id
  3.         ,   hike_date
  4.         ,   hike_title
  5.         ,   hike_group_id
  6.         ,   hike_privacy
  7.         ,   hike_description
  8.         ,   DAYOFMONTH(hike_date)
  9.         ,   DAYNAME(hike_date)
  10.         ,   YEAR(hike_date)
  11.         ,   MONTH(hike_date)
  12. from        scheduled_hikes
  13. where       is_cancelled is null
  14. and         hike_date > DATE_ADD(NOW(), INTERVAL -1 DAY)
  15. and         show_on_home_page = 1  
  16. order by    hike_date limit 4
  17.        
  18. where   (       is_cancelled is null
  19.             and hike_date > DATE_ADD(NOW(), INTERVAL -1 DAY)
  20.             and show_on_home_page = 1
  21.             and hike_privacy != 3
  22.         )
  23. or      hike_privacy is null
  24.        
  25. where       is_cancelled is null
  26.         and hike_date > DATE_ADD(NOW(), INTERVAL -1 DAY)
  27.         and show_on_home_page = 1
  28.         and (      
  29.                     hike_privacy != 3
  30.                 or hike_privacy is null
  31.             )