I'm not sure I understand the question here. It sounds like you want
to do 2 queries (one where MLS is = something and one where MLS !=
something). Is that correct?
In that case you could just use a union to perform the 2 queries and
return them.
select mls, id from mls_id_table where mls='value' union select
distinct mls, id from mls_id_table where mls != 'novalue';
If you are looking for distinct values across the board you might try:
select distinct A.mls, A.id from (select mls_id_table where mls='value'
union select distinct mls, id from mls_id_table where mls != 'novalue')
as A;
To ensure you get adequate performance you might need to make sure your
sort buffer is of adequate size (EXPLAIN the query to find out)..
Otherwise you might find that the queries that use sort will have to
work with a temporary table..
--
Chander Ganesan
Open Technology Group, Inc.
Phone: 877-258-8987/919-463-0999
http://www.otg-nc.com
Expert MySQL training.