[mythtv-users] Search phrase question
Vincent Jorrand
vjorrand at yahoo.com
Wed Feb 18 19:09:44 UTC 2009
> From: Udo van den Heuvel <udovdh at xs4all.nl>> Hello,
>
> Can I 'expand' my current Search Phrase
>
> channel.callsign = "NL1" AND program.starttime < DATE_ADD( NOW( ) , INTERVAL 8
> HOUR )
>
> to something that also searches for callsigns NL2 and NL3?
> Something like:
>
> channel.callsign = "NL1" OR
> channel.callsign = "NL2" OR
> channel.callsign = "NL3" AND
> program.starttime < DATE_ADD( NOW( ) , INTERVAL 8 HOUR )
>
> ?
>
> Do I need parentheses?
>
> ((channel.callsign = "NL1") OR
> (channel.callsign = "NL2") OR
> (channel.callsign = "NL3")) AND
> program.starttime < DATE_ADD( NOW( ) , INTERVAL 8 HOUR )
As the AND has higher precedence than the OR, youneed at least:
(channel.callsign = "NL1" OR
channel.callsign = "NL2" OR
channel.callsign = "NL3") AND
program.starttime < DATE_ADD( NOW( ) , INTERVAL 8 HOUR )
The extra parenthesis are not needed as = has higher precedence than OR (or AND)
You can see the full precedence in mysql (which I believe is the same as the SQL standard) at:
http://dev.mysql.com/doc/refman/5.0/en/operator-precedence.html
Vincent Jorrand
More information about the mythtv-users
mailing list