Gossamer Forum
Home : General : Databases and SQL :

when using MS ACCESS database driven website

Quote Reply
when using MS ACCESS database driven website
I have a db with few tables. 2 main tables and the rest are used to create dropdown menus when adding data. So far all is working very well. The relationships are ok and when I insert data I can see the NAMES stored in the 4 tables.

But when published(with ms access), I only can see the auto_number for each secondary table, not the names stored in it.
--------------------------------------------------
Example:
MAIN TABLE(#1):
ID- autonumber
DATE- date and time
AREA - there are 10 areas, stored in table #2
KIND - kind of date, stored in table #3

TABLE #2
ID_TABLE2 - auto_number
new york
LA
.
.
washington

TABLE #3
ID_KIND - auto_number
sale
rent
--------------------------------------------------
in this situation, when published, I cannot see the names(ny,LA sales,rent) but their correspondent AUTO_NUMBER

The result will look like this:
ID=1
DATE=2/10/00
AREA=2
KIND=2

what I need is area: LA
and kind of entry : rent

Any help would be much appreciated, thanks a lot.
Quote Reply
Re: [dioSRL] when using MS ACCESS database driven website In reply to
You need to write a query that joins the tables and then shows the relevant columns from the "utility type" of tables.

Example:

SELECT tbl_1.*, tbl_2.*, tbl_3.*
FROM tbl_1 INNER JOIN tbl_2 ON tbl_2.PK = tbl_1.FK INNER JOIN tbl_3 ON tbl_3.PK = tbl_1.FK
ORDER BY tbl_1.somecolumn

PK = primary key
FK = foreign key

OR you could even use a belaboured long processing query like the following:

SELECT tbl_1.*, tbl_2.*, tbl3.*
FROM tbl_1, tbl_2, tbl_3
WHERE (tbl_1.FK = tbl_2.PK) AND (tbl_1.FK = tbl_3.PK)

The second is more universal across different database applications (like Oracle that doesn't support inner joins, but does support unions, outer joins, etc.).

You can use the Query Wizard to get the correct SQL statement and also the proper data that you want.

BTW: You can substite .* with the exact column name you want to appear, like .SomeColumn.

I'd suggest searching this forum for SQL links and you will find a few threads where people have linked tutorials and other SQL resources for further help.
========================================
Buh Bye!

Cheers,
Me

Last edited by:

Stealth: Sep 19, 2002, 5:11 PM