Solved

sql where issue

Posted on 2011-09-09
3
195 Views
Last Modified: 2012-08-14
See my below code:

WHERE td.call_back_id = ".$row_rs_call_back_request['id']." AND td.hide_comment IS NULL OR td.hide_comment = 'No'";

I must be writing it incorrectly as I am not getting the correct result.

I basically want the code after the AND grouped.

i.e.

td.call_back_id = ".$row_rs_call_back_request['id']."

AND

(td.hide_comment IS NULL OR = 'No')

I have just put bracket to separate and try to explain what I require, but not sure how to write.

How it makes sense. Ask if not?

0
Comment
Question by:petewinter
3 Comments
 
LVL 19

Assisted Solution

by:Limbeck
Limbeck earned 250 total points
ID: 36510188
hi how about

WHERE td.call_back_id = ".$row_rs_call_back_request['id']." AND ((td.hide_comment IS NULL) OR (td.hide_comment = 'No'))";
0
 
LVL 8

Accepted Solution

by:
Rik-Legger earned 250 total points
ID: 36510195
WHERE td.call_back_id = ".$row_rs_call_back_request['id']." AND (td.hide_comment IS NULL OR td.hide_comment = 'No');

Open in new window

0
 

Author Closing Comment

by:petewinter
ID: 36510274
So Simple... Many thanks :)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Advice and best practice  SQLite3 Database using PHP 2 48
echo paypal data on screen 5 52
AWS EC2 & RDS Instance 5 35
Number of hours between date in DB and now 8 18
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question