On Fri, May 30, 2003 at 16:03:44 -0700,
jtx <[EMAIL PROTECTED]> wrote:
> Basically, I have something like this:
>
> Select o.id,o.num_purch,o.program from orders o left join lists l on
> l.order_id=o.id where o.uid=1 and o.status!='closed'
>
> However, I want to throw an extra conditional in th
Added to TODO:
* Consider using MVCC to cache count(*) queries with no WHERE
clause
---
Bruce Momjian wrote:
> Dennis Gearon wrote:
> > from mysql manual:
> > --
On Fri, 30 May 2003, jtx wrote:
> Hi everyone, I'm trying to do a left join on two tables, mainly because
> data from table 'b' (lists) may or may not exist, and if it doesn't I
> want results. However, if data from table lists DOES exist, I want to
> run a conditional on it, and then return dat
I think, something like this should work:
select o.id,o.num_purch,o.program from orders o left join lists l on
(l.order_id=o.id) where
(l.status is null or l.status!='processing') and o.uid=1 and o.status!='closed'.
(l.status is null should take care about the case when there is no matching row
Hi everyone, I'm trying to do a left join on two tables, mainly because
data from table 'b' (lists) may or may not exist, and if it doesn't I
want results. However, if data from table lists DOES exist, I want to
run a conditional on it, and then return data based on whether the
conditional is true
Is this what you are looking for?
test=# select 'now'::time as test,'2003-05-30 14:51:38-06'::timestamptz
as stamp into temp cruft;
SELECT
test=# select test,stamp,test - stamp::time as diff from cruft;
test | stamp | diff
-++-
15:09:28.8627
On Friday 30 May 2003 21:31, Raj Mathur wrote:
> I'm trying to permit users access to their own records in a database.
> A sample would be:
>
> create table logins
> (
> login char(8),
> name char(32),
> primary key (login)
> );
>
> When a login is added an SQL user is creat
I'm trying to permit users access to their own records in a database.
A sample would be:
create table logins
(
login char(8),
name char(32),
primary key (login)
);
When a login is added an SQL user is created simultaneously. Now I
want the user to be able to view her own
>
> I guess it's a little unclear what to print for the first number when no
> rows are output at all. The code evidently is using the total time spent
> in the plan node, but I think it would be at least as justifiable to
> print a zero instead. Would you have found that less confusing? Anyone
Hello All,
I am looking for an advice how to do calculation with the time. I do have a
column with datatype 'timestamp with time zone'. The value is '2003-03-22
07:53:56-07' for instance. I would like to select it from the table with
result of '07:59:59' '07:53:56', so the query should return
I was afraid someone was going to ask that :)
Okay, I'll do my best at explaining where I'm coming from
I'm working on a mapping application it is user-configurable. What this means (as it pertains to this disucssion) is that the through a configuration file, the user is able to define the ru
Richard Huxton <[EMAIL PROTECTED]> writes:
> On Friday 30 May 2003 4:47 pm, C F wrote:
>> select
>> (case when column1 = column2 then column3 end) as alias1,
>> (case when column1 = column2 then column4 end) as alias2,
>> (case when column1 = column2 then column5 end) as alias3,
>> (case when colum
If your concern is speed, the thing here is that you will have as many records
as there are in "mytable", most of them (I think) with NULLs for alias1, alias2,
alias3 and alias4. This way, there is no condition to filter any record, so
postgreSQL will do a sequential scan over the whole table.
If
> > What I was asking is if there's anyway to use the NEW record to
> > get a list of the columnnames in it without knowing them
> > beforehand.
>
> Not in plpgsql ... and if you did, you couldn't do anything useful
> with the names (like access the fields) anyway. I believe you can
> do it in pl
On Friday 30 May 2003 4:47 pm, C F wrote:
> Hello,
> I already tried this same basic question with no response maybe I was
> too wordy.
I think it's more a case of nobody seeing a better way.
> select
> (case when column1 = column2 then column3 end) as alias1,
> (case when column1 = colu
CF,
> select
> (case when column1 = column2 then column3 end) as alias1,
> (case when column1 = column2 then column4 end) as alias2,
> (case when column1 = column2 then column5 end) as alias3,
> (case when column6 = column7 then column8 end) as alias4
> from
> mytable
Given the informat
On Fri, May 30, 2003 at 08:47:03 -0700,
C F <[EMAIL PROTECTED]> wrote:
> Hello,
> I already tried this same basic question with no response maybe I was too
> wordy. So here it is simplified what's the best way to write this query? I'm
> open to using stored procedures, but even then
Hi
I'm knew to postgres and I got my first C postgres connection working from
the examples in the documentation.
In that it does a BEGIN and a DECLARE CURSOR FOR SELECT et.c. This seems a
long way to go about getting back data each time.
Is it not possible to just do a straight select and not
Hello,
I already tried this same basic question with no response maybe I was too wordy. So here it is simplified what's the best way to write this query? I'm open to using stored procedures, but even then I don't know how I would conditionally populate a resultset (refcursor). Notice th
I attempted the same thing in pl/pgsql but was unable to find a satisfactory
solution using it. I eventually started using tcl as the procedural language
to get this type of effect. Tcl casts NEW and OLD into arrays in a manner
that makes it possible.
Original post:
Subject: PL/
Brian Knox <[EMAIL PROTECTED]> writes:
> What I was asking is if there's anyway to use
> the NEW record to get a list of the columnnames in it without knowing them
> beforehand.
Not in plpgsql ... and if you did, you couldn't do anything useful with
the names (like access the fields) anyway. I be
21 matches
Mail list logo