Forum Moderators: open
What I don't want:
green ¦ house ¦ two ¦ yes ¦ 1991
yellow ¦ house ¦ one ¦ yes ¦ 1973
blue ¦ house ¦ one ¦ no ¦ 1995
green ¦ trailer ¦ one ¦ no ¦ 2001
blue ¦ trailer ¦ one ¦ yes ¦ 2000
What I do want displayed:
green ¦ house ¦ two ¦ yes ¦ 1991
green ¦ trailer ¦ one ¦ no ¦ 2001
Thanks in advance!
select * from table where color='green';
but your question
what I need to happen is for only like the first line
could be several things. Given what you've asked, you could do
select * from table where color='green' order by some_field limit 1;
But most often when this is asked, it's a result of a join. So you could do several things, based on what you're looking for.
Distinct field, in a data set where there are multiple values:
select distinct(rec_id),* from table where color='green';
select table.* from table,join_table where table_id=join_table.join_field;
or
select * from table left join join_table on join_field=rec_id where table.color='green';