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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Difficult query problem

Re: Difficult query problem

From: DFS <nospam_at_dfs_.com>
Date: Sun, 6 Aug 2006 10:35:05 -0400
Message-ID: <C5nBg.15880$WM.13984@bignews1.bellsouth.net>


Michel Cadot wrote:
> "DFS" <nospam_at_dfs_.com> a écrit dans le message de news:
> 9FTAg.46060$Nt.22378_at_bignews8.bellsouth.net...
>> Tough one here, I think. The following data set is building
>> inspection visits. It consists of multiple visits (2+) made to the
>> same building on the same day.
>>
>> There are 3 "conditions" I want to reveal using only SQL statements.
>>
>> 1) visits made by the same employee, for different visit codes (eg
>> records 1 and 2)
>> 2) visits made by different employees, for the same visit codes (eg
>> records 7 and 8)
>> 3) visits made by the different employees, for different visit codes
>> (eg records 36 and 37)
>>
>
> Given the algorithm you use in your VB code I think the following
> query will do the work.

Very nice! I like how it displays which conditions the row meets.

For conditions 1 and 2 it gives the correct rowcounts (206 and 259 respectively), but not for condition 3 (it returns 127 rows but should bring back 177). Example: it returns only one row for BLDG130 on 10-NOV-05, but 3 visits were made to that building on that day. Received on Sun Aug 06 2006 - 09:35:05 CDT

Original text of this message

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