[SQL] Query tuning

2008-05-14 Thread kapil.munish
Hi, I have a query which is run across 3 tables JOB_TYPE_FIRST, JOB_TYPE_SECOND and JOB_ALLOCATION_WORKLIST. The column JOBID is referenced in JOB_ALLOCATION_WORKLIST table and primary key in both JOB_TYPE_FIRST, JOB_TYPE_SECOND tables. There is one more column BOOK_ID which is supplied

Re: [SQL] Auto-formatting timestamps?

2008-05-14 Thread Mag Gam
But why not make a view similar to, select * from checkoutdate do select * from checkoutdate_special_view You don't have to do it for each table, you just do it for your source table, and use the view to manipulate stuff... If you have many tables like that, you can create a view for each of them

Re: [SQL] Auto-formatting timestamps?

2008-05-14 Thread Alvaro Herrera
Peter Koczan escribió: > On Tue, May 13, 2008 at 5:54 PM, Mag Gam <[EMAIL PROTECTED]> wrote: > > Why not create a view? > > That's a possibility, but the issue is that the output formatting is > bound to a data type (timestamp), not one or two particular tables. > Trying to create a view for all t

Re: [SQL] Auto-formatting timestamps?

2008-05-14 Thread Peter Koczan
On Tue, May 13, 2008 at 5:54 PM, Mag Gam <[EMAIL PROTECTED]> wrote: > Why not create a view? That's a possibility, but the issue is that the output formatting is bound to a data type (timestamp), not one or two particular tables. Trying to create a view for all the tables with timestamps (and crea

Re: [SQL] Add a ROWCOUNT to the output of a select.

2008-05-14 Thread Robins Tharakan
Oops! Of course, I meant a sequence. *Robins* On Wed, May 14, 2008 at 2:10 PM, Harald Fuchs <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Robins Tharakan" <[EMAIL PROTECTED]> writes: > > > While we could always check for the query performance reasons, I > > rather think that th

Re: [SQL] Add a ROWCOUNT to the output of a select.

2008-05-14 Thread Marcin Stępnicki
On Wed, May 14, 2008 at 10:40 AM, Harald Fuchs <[EMAIL PROTECTED]> wrote: > I think a sequence is much simpler: > > create temp sequence tmp; > select nextval('tmp') as rownum, >contactdate > from >myTable > where >contactdate > '2007-06-30 23:59:59' > order by >contactdate; I used

Re: [SQL] Add a ROWCOUNT to the output of a select.

2008-05-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Robins Tharakan" <[EMAIL PROTECTED]> writes: > While we could always check for the query performance reasons, I > rather think that this is an overkill for the purpose of mere line > numbers. > If such queries don't change frequently, you could be better off > usi

Re: [SQL] Add a ROWCOUNT to the output of a select.

2008-05-14 Thread Marcin Stępnicki
On Wed, May 14, 2008 at 1:54 AM, Gavin 'Beau' Baumanis <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > After spending some time searching through our good friend Mr. Google and > the mailing list I found a post that provided me with a query that does just > what I need. I think that this should be h