I am trying to build a listbox so that when I query the SMC_THEME it will give me all the related records from SMC_EXTENT
Main Topics
Browse All TopicsI am trying to create a SQL statement where I can retrieve data and place them into list boxes.
The two statements I want to combine are :
select distinct theme_id, theme_desc from smc_theme order by theme_desc
select extent_id, extent_desc from smc_extent where extent_id in (select extent_id from smc_theme_extent where theme_id = " & th & ") order by extent_desc
Your help is need urgently. Thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Comments about jjokocha,
.....u can not use order by {columnname} for union commands.
u have to use order by 2 for this (the column number in Select commands)
select distinct theme_id, theme_desc from smc_theme
union
select extent_id, extent_desc from smc_extent where extent_id in
(select extent_id
from smc_theme_extent
where theme_id = "&th&")
order by 2
Brams
Please update and finalize this old, open question. Please:
1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.
EXPERT INPUT WITH CLOSING RECOMMENDATIONS IA APPRECIATED IF ASKER DOES NOT RESPOND.
Thanks,
Moondancer - EE Moderator
Business Accounts
Answer for Membership
by: jjokochaPosted on 2000-09-21 at 08:33:00ID: 4390235
If you want to combine the results from these two queries use union:
select distinct theme_id, theme_desc from smc_theme
union
select extent_id, extent_desc from smc_extent where extent_id in (select extent_id from smc_theme_extent where theme_id = " & th & ")
order by theme_desc
Notice only one order clause can be used and the columntypes from part 1 and part 2 must be the same.
Good luck!