[comp.databases] sql*forms & multi-table queries

exnirad@brolga.cc.uq.oz (Nirad Sharma) (04/09/90)

lawhorn@optis31.uucp (Jeff Lawhorn) writes:

>I need to be able to do a query based on both the ship date and
>the item.  These are stored in 2 different tables (cust_info &
>order_info), and so far I have not been able to figure out how to
>do this query.  It is a simple join from sql, but the people that
>are going to be using this form have little to no knowlege of
>sql. 

Create a view in SQL*PLUS and then specify that view as the table for the
block in your form. It works fine for the queries (I assume you mean the
ENTQRY- & EXEQRY-type queries) that I have tried. I got problems with
updates to such a block, however. Something along the lines of "CANNOT RESERVE
RECORD". Any ideas ?


Nirad Sharma (exnirad@cc.uq.oz.au)
Continuing Education Unit
The University of Queensland
AUSTRALIA

elgaard@rimfaxe.diku.dk (Niels Elgaard Larsen) (04/09/90)

lawhorn@optis31.uucp (Jeff Lawhorn) writes:

>I hope someone out there can help me...

>I have come across a situation where I need to be able to query
>on more than one table at the same time from within a form.  For
>example, given the following form:

>+--------------------------------------------------------+
>|+-----------------------CUST_INFO----------------------+|
>|| Name:_______________________     ORDER DATE:__/__/__ ||
>|| Addr:___________________________  SHIP DATE:__/__/__ ||
>||      ___________________________                     ||
>|+------------------------------------------------------+|
>|+-----------------------ORDER_INFO---------------------+|
>|| ITEM  DESCRIPTION         QTY  UNIT COST  COST       ||
>|| ____  __________________  ___  __,___.__  ___,___.__ ||
>|| ____  __________________  ___  __,___.__  ___,___.__ ||
>|| ____  __________________  ___  __,___.__  ___,___.__ ||
>|| ____  __________________  ___  __,___.__  ___,___.__ ||
>|| ____  __________________  ___  __,___.__  ___,___.__ ||
>|+------------------------------------------------------+|
>+--------------------------------------------------------+

>I need to be able to do a query based on both the ship date and
>the item.  These are stored in 2 different tables (cust_info &
>order_info), and so far I have not been able to figure out how to
>do this query.  It is a simple join from sql, but the people that
>are going to be using this form have little to no knowlege of
>sql. 

If you only need a query, just make a view in sql and 
then a make a form over the view.

If you want to make updates, you can put a non-database, non-enterable 
field ITEMD in CUST-INFO. Then put 
   "WHERE ITEMD in (SELECT ITEM# from ORDER_INFO
      WHERE DESCRIPTION = :ITEMD)" 
in the ORDER BY clause 





            Niels Elgaard Larsen            | This signature
            Institute of Datalogy,          | contains 2 error
            University of Copenhagen        |
            E-mail: elgaard@freja.diku.dk   |