Skip to main content
Inspiring
May 16, 2008
Question

2 tables 1 datasource

  • May 16, 2008
  • 1 reply
  • 391 views
Hi,

I have a single datasource with two tables. In table 1 I have lots of data with a single column (Notes) containing a value (1-4) which relates to a note. In table 2 I have the corresponding note number and description:

TBL1
Column = Notes
1

TBL2
Column = Note
1
Column = Description
Blah blah bla

I would like to be able to display the correct note description relative to the note number displayed. i.e. the user makes a selection, say 10 results ensue, against two of these notes 1 and 2 appear.

At the bottom of the results page I would like to display notes 1 and 2 with the relevant description.

Hope this makes sense, TIA.

Trevor
This topic has been closed for replies.

1 reply

Inspiring
May 16, 2008
If I understand your requirements correctly I recommend you research "JOIN" and "INNER JOIN" in your database server's documentation.
Participating Frequently
May 16, 2008
Your query would resemble something like one of these:

SELECT t1.yourtable1columns, t2.Description
FROM tbl1 t1
INNER JOIN tbl2 t2 ON t1.notes = t2.note
WHERE whateverelse

or

SELECT t1.yourtable1columns, t2.Description
FROM tbl1 t1, tbl2 t2
WHERE t1.notes = t2.note
AND whateverelse

Phil