Re: Need help forming a query

From: Jim West <Jim_at_jameswest.com>
Date: Thu, 18 Nov 1999 15:48:30 GMT
Message-ID: <gn783s456kc2hfg5sifp7d0o0671lp155c_at_4ax.com>


On Thu, 18 Nov 1999 15:16:09 GMT, Jim West <P3C2_at_jameswest.com> wrote:

Ok...I think I got it figured out...I will get the hang of the SQL stuff yet!

select switchid,count1,count2,count3
from COUNTS, SWITCHINFO
where switchid = name and
include = 'Y';

>Howdy all,
>
> Ok, here is what I'm trying to accomplish.
>
> I have a table called SWITCHINFO that contains a column called NAME
>and a column called INCLUDE. There are other columns as well. NAME
>is varchar2(4) and INCLUDE is varchar2(1). INCLUDE values are either
>a 'Y' or 'N'.
>
> I have another table called COUNTS that has columns for various
>count information as well a column called SWITCHID.
>
> I need to be able to query the COUNTS table and retrieve only those
>rows whose SWITCH name matches those in the SWITCHINFO table whose
>INCLUDE value is 'Y'.
>
> How do I do this?
>
>SWITCHINFO:
>
>NAME INCLUDE
>----------- ----------------
>AAAA Y
>BBBB N
>
>
>
>COUNTS:
>
>SWITCHID COUNT1 COUNT2 COUNT3
>------------------ --------------- -------------- ------
>AAAA 10 20 30
>BBBB 50 40 30
>
>
>The query should ONLY return the row containing AAAA from the COUNTS
>table.
>
>
>Thanx!!
>
Received on Thu Nov 18 1999 - 16:48:30 CET

Original text of this message