Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Complicated SQL question

Re: Complicated SQL question

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 06 Oct 2005 16:57:04 -0700
Message-ID: <1128643022.839717@yasure>


neurotoxin2309_at_yahoo.com wrote:
> I'll really demonstrate my ignorance by posting this, however I did a
> select distinct on message_no to find out which messages we had records
> for. Then I used a macro to generate quite a few of these:
>
> select '1', count(message_no) from message_direction
> where direction <> 1
> and message_no = 1;
>
> Then I used Excel so I only had the message number and count result,
> then I went back to a macro and generated a bunch of these:
>
> select b.message_no, a.address, c.subject, c.message_date, 72 as
> recipients
> from email_id_x_address a, message_direction b, message_header c
> where b.message_no = c.message_no
> and b.direction = 1
> and a.email_id = b.email_id
> and b.message_no = 1785;
>
> The 72 was derived from the previous query, because I didn't know how
> to get it all in a single field.
>
> As you can see I'm over my head with complicated queries, I generally
> just do selects. I'd really like to learn how to do this properly
> though, and thought this would be a good opportunity.

I'd suggest you put away toys like Access and Excel, go to Morgan's Library at www.psoug.org, and open a SQL*Plus session.

Then try the examples for SELECT, JOIN, WHERE clause, and other DML statements. Observe what is happening and learn from them.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Thu Oct 06 2005 - 18:57:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US