For #1, if you had parentheses around what you want together, MySQL will understand what to return. For example (no logic here, just example): SELECT * FROM table WHERE ( this=this ) AND ( ( that=that OR thing=thing ) OR ( ( blah=blah OR foo=foo ) AND ( bar=bar OR etc=etc ) ) )
----- Original Message ---- From: Kristina Anderson <[EMAIL PROTECTED]> To: talk@lists.nyphp.org Sent: Wednesday, May 28, 2008 3:42:44 PM Subject: [nyphp-talk] MySQL Syntax questions I have two questions regarding syntax for MySQL queries. 1. I have complex queries where there are lots of conditional statements, i.e. SELECT * FROM table WHERE this=this AND that=that OR thing=thing OR blah=blah OR foo=foo AND bar=bar OR etc=etc OR thing2=thing2... They are not erroring out but they aren't narrowing the resultset sufficiently...do I need parentheses or is there something else I need? 2. How can I select the last row inserted from a table WHERE field1=somethingineed and field2 is NULL? Thanks in advance...full of questions today I am! --- Kristina _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php
_______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php