sql query problem [message #20356] |
Thu, 16 May 2002 03:47 |
Joe Lawler
Messages: 1 Registered: May 2002
|
Junior Member |
|
|
A table 'Page' holds attributes such as Name, Desc. etc. for pages included in the table 'Page_flow'.
These tables are linked as follows:
Page.page_id-->Page_flow.current_page_Id and
Page.page_id-->Page_flow.next_page_Id.
The primary key of the page table is page_id
The primary key of the page_flow table is the combination of current_page_id and next_page_id
This double join is causing me problems when constructing a query to retrieve the current page name and the next page name for a particular page flow. How can such a query be set up. Any help is much appreciated. Thanks
Joe
|
|
|
Re: sql query problem [message #20360 is a reply to message #20356] |
Thu, 16 May 2002 07:40 |
Phenoracle
Messages: 35 Registered: March 2001
|
Member |
|
|
Hi,
I think you might use the or clause to help out.
Here is my example.
SQL> DROP TABLE t
2 /
Table dropped.
SQL>
SQL> DROP TABLE s
2 /
Table dropped.
SQL>
SQL> CREATE TABLE t (a INT, c CHAR(3))
2 /
Table created.
SQL>
SQL> CREATE TABLE s( a INT, b INT)
2 /
Table created.
SQL>
SQL>
SQL> INSERT INTO t VALUES(2, 'kaz')
2 /
1 row created.
SQL>
SQL> INSERT INTO t VALUES(2, 'bob')
2 /
1 row created.
SQL>
SQL>
SQL> INSERT INTO s VALUES(1 , 2)
2 /
1 row created.
SQL>
SQL>
SQL> SELECT *
2 FROM t, s
3 WHERE t.a = s.a OR t.a = s.b
4 AND s.a = 1
5 /
A C A B
--------- --- --------- ---------
2 kaz 1 2
2 bob 1 2
SQL>
Get in touch if you need some more help
Have Fun
Phenom
|
|
|