I have a table structure such as:
ID|fieldname|fieldvalue
1|name|jon
1|email|jon@jon.com
2|name|jon
2|emailjonathan@domain.com
3|name|jon
3|emailjonathan@domain.com
What I'm trying to do is query in WHERE name=jon and email=jon@jon.com, but I need the ID of rows that matches the entire WHERE clause.
I was trying something like:
SELECT * FROM table WHERE (table.fieldname='jon' AND table.fieldvalue='jon') OR (table.fieldname='email' AND table.fieldvalue='jon@jon.com');
I'm getting the results, but I'm trying to figure out how to pull out the rows that matched the WHERE clause.