Answer the question
In order to leave comments, you need to log in
How to fix a query in the database?
I have a table in the database, it has two enum fields:
1. photo = has the values yes or no
2. video = has the same values yes or no
There is a task to write a query that would select all records that have photo or video marked with the value yes .
So far I've thought of this:
$result = $mysql->query("SELECT * FROM news WHERE photo = 'yes' AND video = ' yes'");
Answer the question
In order to leave comments, you need to log in
photo = 'yes' AND video = ' yes'
gives records where photo and video are both yes
photo = 'yes' OR video = ' yes'
gives records where either photo and video are both yes or either of the photo and video fields is yes
result = $mysql->query("SELECT * FROM news WHERE photo = 'yes' OR video = ' yes'");
result = $mysql->query("SELECT * FROM news WHERE photo = 'yes' OR video = ' no'");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question