MySql select by column value. Separeta operator for columns.
- by andy
Hi all, i have a mysql table like this
+-----+---------+-----------+-----------------+-------+
| id | item_id | item_type | field_name | data |
+-----+---------+-----------+-----------------+-------+
| 258 | 54 | page | field_interests | 1 |
| 257 | 54 | page | field_interests | 0 |
| 256 | 54 | page | field_author | value |
+-----+---------+-----------+-----------------+-------+
And, I need build query like this
SELECT * FROM table WHERE
`field_name`='field_author' AND `field_author.data` LIKE '%jo%'
AND
`field_name`='field_interests' AND `field_interests.data`='0'
AND
`field_name`='field_interests' AND `field_interests.data`='1'
This is sample query. MySql can't do queries like that. I mean than
SELECT * FROM table WHERE name='jonn' AND name='marry' will return 0 rows.
Cant anybody help me.
Thanks.