Hi everyone. I'm just beginning to study SQL and have not yet written an SQL command on my own yet…although I've tried. I was hoping I could get a little assistance writing a command or two. I'm using Access 2013.
My movie database has a check box for Foreign, to indicate whether the movie is foreign or not. If it is checked, it is foreign. In the table (tblMovies), the field name is Foreign, and has only YES or NO values.
I'm trying to write an SQL command to show only the records that have YES in the Foreign field. I want the query to show all the fields.
First, I created a simple query with all the fields, named qryForeign.
Then, I tried writing the following command, which didn't work:
SELECT *
FROM tblMovies
WHERE Foreign='Yes';
The error box said, "Data type mismatch in criteria expression."
I'm assuming the asterisk is the problem, but I'm not sure what to do next. Would anyone like to help me correct this problem? Am I close?
Now…to make things a little more complicated…once I solve the above problem, I would like to write a second SQL statement.
I have three subforms. One is called subgenre, and has movie genres such as Comedy, Documentary, Animation, Western, Foreign, etc.
I'd like to write an SQL statement that displays only the records that have BOTH the Foreign check box checked, AND has Foreign listed in the Genre subform.
Is that possible?
Each of the three subforms has its own junction table, since I am working with many-to-many relationships. The junction table for the Genre subform is jnctGenre.
I don't want anyone to write the SQL commands for me; instead, I'd like help writing it myself. Thank you! Warrren Page