aliashippysmom
Programmer
Hi! I have an exhibitor database for an conference. I want to display all exhibitors currently signed up to exhibit for 2006. But if they signed up in 2005, and not in 2006 yet, I want to display these in the same list.
is what I had until I was tasked to add 2005 exhibitors that are not in 2006.
The following query works, but I get duplicate exhibitor names:
This works, too:
I want to do something like this, but it does NOT work:
BUT I need to have the key field retrieved as well, because as the exhibitors are displayed the user can click on the name to get more information. I can write two queries to do this, by using the distinct one that works, but is there a way to write just one query? Can't use distinct for that, since all the keys are naturally distinct. I hope this makes sense. Can anyone help? Thanks in advance.
Code:
SELECT * FROM Exhibitor
WHERE exhibit_year = '2006'
is what I had until I was tasked to add 2005 exhibitors that are not in 2006.
The following query works, but I get duplicate exhibitor names:
Code:
SELECT * FROM Exhibitor
WHERE exhibit_year IN ('2006','2005')
ORDER BY exhibitor_name
Code:
SELECT distinct exhibitor_name FROM Exhibitor
WHERE exhibit_year IN ('2006','2005')
ORDER BY exhibitor_name
I want to do something like this, but it does NOT work:
Code:
SELECT distinct exhibitor_name, exh_id FROM Exhibitor
WHERE exhibit_year IN ('2006','2005')
ORDER BY exhibitor_name
BUT I need to have the key field retrieved as well, because as the exhibitors are displayed the user can click on the name to get more information. I can write two queries to do this, by using the distinct one that works, but is there a way to write just one query? Can't use distinct for that, since all the keys are naturally distinct. I hope this makes sense. Can anyone help? Thanks in advance.