Home > Archive > MS Access database support > February 2006 > near-newbie question about loops, subqueries etc









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author near-newbie question about loops, subqueries etc
bjacob@laposte.net

2006-02-18, 8:24 pm

Hi all,
this has bugged me for some time now.

I've a traditional situation, let's say a table A with some restaurant
menu and table B with all the possible dishes.
Now I need to put on an asp page a table which iterates through all the
menus and shows the many related dishes under each menu.
If I write something like:
SELECT * FROM menus LEFT JOIN dishes ON......etc
I obtain a neat table with the same menu repeated for each dish.
If I write something like:
SELECT DISTINCT [id, etc...] FROM menus LEFT JOIN dishes ON......etc
I miss many of the dishes :)

Till now I used to split the query in two: first the menus, loop
through the recordset and at each loop closing and re-opening the query
for the dishes. But this is so inelegant: I'd really want a single
query and the ability to iterate at choice through the main recordset
or the nested one. I know this is possible in SQLServer, but in Access?
I use ASP/Jscript but I suppose this is irrelevant :)

Thank you a lot for any suggestion
Barbara

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com