Re: [SQL] Interval subtracting

2006-02-20 Thread Milorad Poluga
Thank you all for suggestions and links. Currently, I am working on  PostgreSQL 8.0.4., so I cannot use justify_*() functions. Regards, Milorad Poluga [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [SQL] SELECT on a to-be-determined table

2006-02-20 Thread Patrick JACQUOT
garhone wrote: Hi, I'm a new at this. So please forgive if I mess up. Also, if there is already a reference/tutorial somewhere, feel free to point me to it. Here's my situation: db=# select * from projects; projid | projname +-- 1 | cars 2 | houses 3 | pets (3 ro

Re: [SQL] Need help: Find dirty rows, Update, Delete SQL

2006-02-20 Thread Patrick JACQUOT
Janning Vygen wrote: Am Samstag, 18. Februar 2006 18:41 schrieb [EMAIL PROTECTED]: Hello, I need a bit of help with some SQL. I have two tables, call them Page and Bookmark. Each row in Page can have many Bookmarks pointing to it, and they are joined via a FK (Page.id = Bookmark.page_id).

Re: [SQL] ORDER BY CASE ...

2006-02-20 Thread Bruno Wolff III
On Mon, Feb 13, 2006 at 22:28:38 +0100, Mario Splivalo <[EMAIL PROTECTED]> wrote: > Can't do so, because receiving_time is timestamptz, and "from" is > varchar. There: > > pulitzer2=# select id, "from", receiving_time from messages order by > case when 2=3 then "from" else receiving_time end des

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-20 Thread Pedro B.
Hello. I'm having difficulties on my first incursion through generate_series. The details: SELECT DATE_TRUNC('month', timestamp '2006-02-01' )::DATE + s.d AS date,       COUNT (o."04-sms") as totalcause98       FROM generate_series(11,19) AS s(d)  LEFT JOIN netopia o ON (substr(o."26-insertTime",

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-20 Thread Mark R. Dingee
Pedro, Would something such as this suffice? Mark create function get_date_range(date, date) returns setof date as ' DECLARE     cur date; BEGIN     cur := $1;     while cur <= $2 LOOP          return next cur;          cur := cur + interval ''1 day'';     end LOOP;     return; END;' language

Re: [SQL] ... more than one count with left join

2006-02-20 Thread Pedro B.
On Monday 20 February 2006 20:39, Mark R. Dingee Pedro wrote: |>  Pedro, |> |>  Would something such as this suffice? Hello Mark, It's far superior to what i was doing, serialization wise. Thank you. However, it still leaves me with the big headache of the left joins with the "count ... where..

Re: [SQL] ORDER BY with LTREE

2006-02-20 Thread Michael Fuhr
On Mon, Feb 20, 2006 at 11:15:43AM +0100, Axel Straschil wrote: > I have a table with a ltree and acaption "CREATE TABLE (tree LTREE, > caption TEXT)", I can't store the data of caption in the ltree, becouse of > the limitation of the ltree labels. I use the ltree to give the captions > a direco