php - SQL - Double and statement -


this question has answer here:

i trying select data 2 tables, conditions has true. trying join and/or statements together.

select      a.token, a.fixed_expire, b.token, b.username, count(distinct a.token) adcount,      count(distinct b.username) clickcount     advertisements      join advertisement_clicks b on b.token=a.token     a.status='2' , (a.clicks_left > 0 or a.daily ='1' or a.fixed='1' and(a.fixed_expire>'2')) 

so, above query doesn't work. question is, how can join or a.fixed='1' and(a.fixed_expire>'2') inside original and operation?

if a.fixed='1' should check a.fixed_expire>2

(a.clicks_left > 0 or a.daily ='1' or a.fixed='1' )and(a.fixed_expire>'2')

you should group or statements


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -