PDA

View Full Version : Getting Values from another table.


Bengal313
07-09-2004, 08:48 PM
I have a database that has 2 tables. "tblparcel" and "tblGaragetype". I have created a recordset that displays all the fields in the tblparcel table. Now one of the fields in the tblparcel table is called "garagecode" . This has a value of 1, 2, or 3. The table tblgaragetype has 2 fields "garagecode" and "desc" . It only has 3 records. This table contain the descriptions of the garage code. Now as I stated I have a recordset that displays all the fields of the tblparcel table. Is there a way I can instead of displaying the garagecode from the parcel table. Take that code and match it to the description in the tblegaragetype table and display that instead?

sad69
07-09-2004, 09:48 PM
Yes. There are a couple of ways to do this, but the best way is by altering your query:
'select * from tblparcel, tblGaragetype where tblparcel.garagecode=tblGaragetype.garagecode';

Then instead of displaying 'garagecode', display 'desc'. Make sense?

Hope that helps,
Sadiq.

Bengal313
07-13-2004, 06:36 PM
This is my sql statement. I have a search page that takes in the Parcel_Number from a form and searchs against the "tbleparcel" table. How can I alter this table to get the desired output.


SELECT *
FROM tblparcel
WHERE Parcel_Number = 'colname'

sad69
07-13-2004, 06:49 PM
SELECT *
FROM tblparcel, tblGaragetype
WHERE Parcel_Number = 'colname' AND tblparcel.garagecode=tblGaragetype.garagecode'


Let me know how that works out.

Sadiq.