How do I write a mysql query so that I can select entries under a column that are equal to resultA or resultB or resultC etc.
Something like:
SELECT * FROM myTable WHERE myColumn = resultA OR WHERE myColumn = resultB OR WHERE myColumn = resultC...
$query = "SELECT * FROM my_table WHERE categories LIKE '2'"; $rows = mysql_query($query); This returns row if column only has value 2 but not 1,2,3 or 2,12.
Here's the generic SQL query to two compare columns (column1, column2) in a table (table1). mysql> select * from table1 where column1 not in (select column2 from table1); In the above query, update table1, column1 and column2 as per your requirement.
The SET clause indicates which columns to modify and the values they should be given. Each value can be given as an expression, or the keyword DEFAULT to set a column explicitly to its default value.
Click the top edge of the column header or the column in the table. The following selection arrow appears to indicate that clicking selects the column. Note: Clicking the top edge once selects the table column data; clicking it twice selects the entire table column.
SELECT *
FROM myTable
WHERE myColumn = 'resultA'
OR myColumn = 'resultB'
OR myColumn = 'resultC';
Alternatively,
SELECT *
FROM myTable
WHERE myColumn IN ('resultA', 'resultB', 'resultC');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With