MySQL Query Problem

admin

Administrator
Staff member
I have a table structure such as:

ID|fieldname|fieldvalue
1|name|jon
<!-- e --><a href="mailto:1|email|[email protected]">1|email|[email protected]</a><!-- e -->
2|name|jon
<!-- e --><a href="mailto:2|[email protected]">2|[email protected]</a><!-- e -->
3|name|jon
<!-- e --><a href="mailto:3|[email protected]">3|[email protected]</a><!-- e -->

What I'm trying to do is query in WHERE name=jon and [email protected], 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='[email protected]');

I'm getting the results, but I'm trying to figure out how to pull out the rows that matched the WHERE clause.
 
Back
Top