List:MaxDB« Previous MessageNext Message »
From:Brian Kavanaugh Date:April 6 2003 4:51pm
Subject:RE: Union in dbproc
View as plain text  
-----Original Message-----
From: Peter Willadt [mailto:Willadt@stripped]
Sent: Sunday, April 06, 2003 10:31 AM
To: Brian Kavanaugh; sapdb.general@stripped
Subject: Re: Union in dbproc

> Please excuse me when I'm wrong and also please excuse when my remark is
no
> direct solution to your question, but to me it appears as if the two
queries
> that form the union are identical with the exception of the WHERE clause.
> So you could probably build just one query and combine the two conditions
with
> an OR in the where part. I guess it would also run faster than before.
> So, the where part should look like this:
>
>   WHERE
>      tblCalendar.isApproved = true AND
>      ((DATE <= tblCalendarDtl.EventDate AND
>        DATEDIFF( DATE, tblCalendarDtl.EventDate ) < 7
>       )
>       OR
>       (UPPER( tblEventType.EventType ) = 'DEADLINE' AND
>        DATE <= tblCalendarDtl.EventDate AND
>        DATEDIFF( DATE, tblCalendarDtl.EventDate ) < 30
>      ))
>
> Peter Willadt

Is that correct in SAP DB? In MS SQL Server I know that unions are much
faster than using an OR in the WHERE clause... That is the reason I did it
that way, though of course the OR is easier to read, in my opinion...



Thread
Union in dbprocBrian Kavanaugh6 Apr
  • Re: Union in dbproc(Peter Willadt)6 Apr
    • RE: Union in dbprocBrian Kavanaugh6 Apr
RE:Union in dbprocThomas Anhaus7 Apr
  • Unknown Result TableBrian Kavanaugh12 Apr
re: Unknown Result TableBrian Kavanaugh13 Apr
Re: Unknown Result TableMarcin P14 Apr