help with multi-table query

help with multi-table query

Post by Rickey Thomas T » Thu, 04 Mar 1993 00:58:48



I hope someone out there can solve the following problem

I have two tables  

table1                              table2
    lastName                           firstName      lastName
     tom                                 doug           tom
     john                                doug          john
     jackson                             mathew         john
     wilson

I need an SQL statement which will

1) fetch all lastnames from table1 WHICH ARE NOT in Table2 and the firstname is
   doug

Such a query, when applied to the above will return a list from table1 which
include jackson, wilson. The lastname fields are foreign keys.

Any help would be greatly appreciated. Thank you in advance
--
--------------------------------------------------------------------------------

Programmer/Analyst Project ZE    | UUCP          : ...!uunet!uupsi2!aruba!rickt
--------------------------------------------------------------------------------

 
 
 

help with multi-table query

Post by Frank Munke » Thu, 04 Mar 1993 20:37:24



Quote:>I hope someone out there can solve the following problem
>I have two tables  
>table1                              table2
>    lastName                           firstName      lastName
>     tom                                 doug           tom
>     john                                doug          john
>     jackson                             mathew         john
>     wilson
>I need an SQL statement which will
>1) fetch all lastnames from table1 WHICH ARE NOT in Table2 and the firstname is
>   doug
>Such a query, when applied to the above will return a list from table1 which
>include jackson, wilson. The lastname fields are foreign keys.

   SELECT lastName FROM table1
   WHERE lastName NOT IN
     (SELECT lastName FROM table2
      WHERE firstName = "doug")

---
Frank Munkert            |  Uni Erlangen-Nuernberg
Zum Froschbruecklein 5   |  



 
 
 

help with multi-table query

Post by informix users » Fri, 05 Mar 1993 06:48:06


rick,

i stand corrected. the query sent in by frank will give the correct
answer.

bob baskett

 
 
 

1. HELP PLEASE: URGENT: Need help forming a multi table query

Hello,

I'm using SQL SERVER 7.0. I'm very new to Multi-Table querying, and
can't seem to figure this one out. Any help would be appreciated.

I have 2 tables. one is called RATES and one is called BILLING

In the BILLING table, there are 2 columns, one is COUNTRY and
the other is ACTUAL.  In the RATES table, there are two columns
COUNTRY (which you would use to match the rate to) and RATE.

This is for an ASP page. It has to go row by row of the BILLING
table and calculate the total of a phone call, by multiplying the
ACTUAL of BILLING column with the RATE for that COUNTRY.
It sounds simple, but I get strange (wrong) results everytime.

Any help would be appreciated.  Thanks in advance.

Ayaz Asif

2. DTS/Import

3. Help Multi table Query

4. Memory Leak & Delete Problems

5. HELP: URGENT: MULTI-TABLE Query (SQL7)

6. Running stored procedures asynchronously

7. help with multi-table query

8. Help please with multi-table query

9. Need help trying to set up Query across multi tables

10. Empty tables in a multi-tables query