MySQL
table1:
+----+--------+---------+------+
| id | itemid | type | name |
+----+--------+---------+------+
| 1 | 1 | product | t |
+----+--------+---------+------+
| 2 | 2 | product | t |
+----+--------+---------+------+
| 3 | 3 | service | t |
+----+--------+---------+------+
table2:
+--------+---------+
| itemid | display |
+--------+---------+
| 1 | 1 |
+--------+---------+
PHP
$a = mysql_query("SELECT * FROM `table1` WHERE `name` LIKE '%t' ....");
I want to modify the query above and also test:
If type = product then itemid should not be included in table2 where display = 1.
Further Explanation:
So, I want to see whether or not the row in table1 that matches t is a product.
If it is not a product (i.e. service), just go ahead and display it.
If it is a product, I want to further check whether or not its itemid is included in table2
If it is included, then don’t display it.
If it is not included, then display it.
Sorry, I don’t know how else to explain it. :/
If I understand you correctly, you want to exclude rows whose type = ‘product’:
(If that’s not what you want, IMHO some further explanation is necessary)
UPDATE: to exclude all whose type = ‘product’ having a matching row in table2: