Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

MySQL syntax

This SQL fails:

SELECT * from schedule where date = '2012-09-20', * from cancellation_list where sc = 'Y' and sc_date = '2012-09-20'

The table schedule has a column date and the table cancellation_list has columns sc and sc_date.

The error is:

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ' * from cancellation_list where sc = 'Y' and sc_date = '2012-09 .

What is the correct syntax?
Richard Korts
Richard Korts
1 Solution
Try this.

select * from schedule s inner join cancellation_list c
on s.date = c.sc_date
where c.sc = 'Y' and c.sc_Date = '2012-09-20'

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now