Hi
I have a table which I am trying to pull some data out of. I am trying to select all the data where one field matches two numbers.

mysql_query ("SELECT articles.*,articles_comments.*
                                FROM articles LEFT JOIN articles_comments
                                ON articles.id= articles_comments.articleid
                                WHERE articles.cat_id='$cat_id'
                                AND articles.status='1');

what I want to do is select all the articles which status is 1 or 12.

is that possible

Use parenthesis for grouping just like math

SELECT * FROM sometable WHERE somefield = 1 AND (anotherfield = 1 OR anotherfield = 12)

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.