[SQL] hi all......................!!

2006-01-24 Thread AKHILESH GUPTA
hello everybody i am new to this mailing list. this is my first mail to this group. i jussst want to confirm that whether is it possible to update a view or not?? i think you all help me in solving my queries in future...!! -- Thanks & Regards, Akhilesh DAV Institute of Managem

Re: [SQL] sorting by day of the week

2006-01-24 Thread ipv
Hi, Try to use a calculated index: (tested similar solution, but not this code) CREATE OR REPLACE FUNCTION TestOrder (nameTable.weekDay%TYPE) RETURNS INT AS ' DECLARE numWeekDay INT; BEGIN if ($1 = ''Wed'') then numWeekDay := 1; if ($1 = ''Tue'') then numWeekDay := 2; . RETURN (nu

Fw: [SQL] stored procedures for complex SELECTs

2006-01-24 Thread ipv
For better performance, try to utilize prepared statements; example: PREPARE CPrep_Clients (varchar(20)) AS SELECT * FROM client WHERE nom = $1; EXECUTE CPrep_Clients('Francio'); In my system, over 51ms difference between standard select (prepared by-pass planification/optimization) Reg

Re: [SQL] sorting by day of the week

2006-01-24 Thread Joseph Shraibman
Nevermind, I figured out that I just needed to do it like this: SELECT to_char( logtime, 'Dy'),count(*),to_char( logtime, 'D') FROM sclog WHERE date_trunc('day', logtime) > current_date + '7 day ago'::interval group by to_char( logtime, 'Dy'),to_char( logtime, 'D') ORDER BY to_char( logtime, '

[SQL] sorting by day of the week

2006-01-24 Thread Joseph Shraibman
p8:owl=>SELECT to_char( logtime, 'Dy'),count(*) FROM logtab WHERE date_trunc('day', logtime) > current_date + '7 day ago'::interval group by to_char( logtime, 'Dy') ORDER BY to_char( logtime, 'Dy') DESC; to_char | count -+--- Wed | 1447 Tue | 618 Thu | 1161 Sun

Re: [SQL] How to implement Microsoft Access boolean (YESNO) fieldtype in PostgreSQL ?

2006-01-24 Thread codeWarrior
SELECT fieldlist, CASE WHEN myboolean = true THEN 1 ELSE 0 END FROM tblname WHERE condition; ""Jesper K. Pedersen"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I am have some difficulties converting the Microsoft field of type > YESNO (which is a simple boolean true/false)

Re: [SQL] How to implement Microsoft Access boolean (YESNO)

2006-01-24 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > Is there an implicit cast from ints? So if I pass a 0 or 1 argument for a > boolean parameter now it'll work? That definitely didn't work in the past. 1. There's a cast. 2. It's not implicit. 3. You have always (well, at least since 7.0 which is the olde

Re: [SQL] How to implement Microsoft Access boolean (YESNO)

2006-01-24 Thread PFC
On Tue, 24 Jan 2006 06:03:48 +0100, Greg Stark <[EMAIL PROTECTED]> wrote: Tom Lane <[EMAIL PROTECTED]> writes: Greg Stark <[EMAIL PROTECTED]> writes: > "Jesper K. Pedersen" <[EMAIL PROTECTED]> writes: >> Having checked the I/O format it seems that MS Access exports the >> values of a YESNO fie

Re: [SQL] non-equi self-join optimization

2006-01-24 Thread Bruno Wolff III
On Tue, Jan 17, 2006 at 12:57:30 -0800, George Pavlov <[EMAIL PROTECTED]> wrote: > I have a table of names with two subsets of entities. I want to find > those names from set 1 that are substrings of names from set 2 from the > same table. Basically the pared down query I want is something like >