PDA

View Full Version : dreamweaver advance recordset help


kontrol
06-22-2011, 10:13 PM
hello, i will be glad to get your help on this. i want to pu this code in dreamweaver advance recordset but i dont get it right. SELECT * FROM people JION rels ON people.id = rels.m_id AND rels.y_id OR people.id = rels.y_id AND rels.m_id = 1. i am srry if the post does not appear well, i am using opera mini right now so could put in code tags

jmichae3
06-26-2011, 10:52 PM
get your spelling right. not jion, join. not srry, sorry. you may also run into trouble not using perens on your ands and ors to group them in the grouping order that you want them evaluated, otherwise, the SQL interpreter is simply going to evaluate them left to right, and that could be messy and give you unintended results.
I think what you had intended was this:

SELECT *
FROM people JOIN rels
ON (people.id = rels.m_id AND rels.y_id) OR (people.id = rels.y_id AND rels.m_id = 1)

or

SELECT * FROM people JOIN rels ON (people.id = rels.m_id AND rels.y_id) OR (people.id = rels.y_id AND rels.m_id = 1)


It is possible that AND has higher precedence than OR in which case your code would work, but like any standard language, it could be implementation-dependent, and I wouldn't rely on it. so put the perens in where you need them.

SQL allows for nicely formatted queries. your programming language may or may not. PHP does if you use double quotes.