MySQL Limiting a query to one consistent value
- by Lucas Matos
My current query returns a table like:
+------------+
value1 | ....
value1 | ....
value2 | ....
value3 | ....
+------------+
I want:
+------------+
value1 | ....
value1 | ....
+------------+
I want to only receive all rows with the first value. Normally I would do a WHERE clause if I knew that value, and I cannot use a LIMIT because each value has a different number of rows.
Right now My query looks like "SELECT u.*, n.something, w.* FROM ... AS u, ... AS n, ... AS w WHERE u.id = n.id AND w.val = n.val AND u.desc LIKE '%GET REQUEST VARIABLE%';"
This works great, except I get way too many rows and using PHP to do this ruins code portability and is superfluous.
Thanks for reading