Re: [SQL] right join problem

2009-10-01 Thread A. Kretschmer
In response to Greenhorn : > > > > Use a left join instead? > Hi, > Yes, but when i use a where clause on my query it only selects joined > records. :( > Thanks. Please, answer to the list and not directly to me. The WHERE-Clause works after the JOIN - so your select contains (without the WHERE)

Re: [SQL] right join problem

2009-10-01 Thread A. Kretschmer
In response to Greenhorn : > Hi, > > I'm trying to retrieve all meter_id from table meter, and for meter_id > without amount, I'd like it to show nothing, 'null'. I've used right > join here but it's not giving me my desired result. Is there another > way to do this? Here's the query I'm trying

[SQL] right join problem

2009-10-01 Thread Greenhorn
Hi, I'm trying to retrieve all meter_id from table meter, and for meter_id without amount, I'd like it to show nothing, 'null'. I've used right join here but it's not giving me my desired result. Is there another way to do this? Here's the query I'm trying. Thanks in advance! select m.meter_i

Re: [SQL] Need magic for a moving statistic

2009-10-01 Thread A. Kretschmer
In response to Andreas : > Hi, > > I need some magic for a moving statistic that works on a rather big > table starting at a given date within the table up until now. > The statistic will count events allways on fridays over periods of 2 > weeks before ... biweekly? > So I'd like to get a line e

Re: [SQL] SQL moving window averages/statistics

2009-10-01 Thread Andreas
Just 3 points ... 1) don't use "date" as a column name because it's a data type. 2) to_char(current_date, 'MM')||to_char(current_date, 'DD') is equivalent to to_char(current_date, 'MMDD') 3) you should get the same result with ... where icao='KSFO' and (EXTRACT (MONTH from d

[SQL] Need magic for a moving statistic

2009-10-01 Thread Andreas
Hi, I need some magic for a moving statistic that works on a rather big table starting at a given date within the table up until now. The statistic will count events allways on fridays over periods of 2 weeks before ... biweekly? So I'd like to get a line every 2 weeks for everthing between.