troubleshooting Question

Adding a condition to a query

Avatar of David Schure
David Schure asked on
PHP
2 Comments1 Solution17 ViewsLast Modified:
Trying to add a condition to this query...Not well versed in PDO
$sql = <<<QUERY
SELECT 
  `s`.`session_id` AS ID,
  DATE_FORMAT(
    `s`.`session_date`,
    "%W, %M, %d, %Y"
  ) AS `DATE`,
  TIME_FORMAT(
    CONCAT(`s`.`time_slot_id`, ":00:00"),
    "%h:%i %p"
  ) AS `TIME`,
  `s`.`session_type` AS `TYPE`,
  `t`.`therapist_name` AS `THERAPIST`,
  `sc`.`session_status` AS `STATUS` 
FROM
  tbl_session_client sc 
  LEFT JOIN tbl_session s 
    ON `s`.`session_id` = `sc`.`session_id` 
  LEFT JOIN `tbl_therapist` `t` 
    ON `t`.`therapist_id` = `s`.`therapist_id` 
WHERE `sc`.`client_id` = :client_id 
ORDER BY `session_date` DESC
QUERY;
The condition is:
AND tbl_session.session_status="Booked"
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros