Re: [SQL] yet another simple SQL question

2007-06-26 Thread John Summerfield
Joshua wrote: Ok, You guys must be getting sick of these newbie questions, but I can't resist since I am learning a lot from these email I'm not fond of people using meaningless subjects, or of people simultaneously posting the same message to other lists. If one chooses a meaningless

Re: [SQL] yet another simple SQL question

2007-06-26 Thread Bart Degryse
A. Kretschmer [EMAIL PROTECTED] 2007-06-25 20:07 am Mon, dem 25.06.2007, um 12:44:25 -0500 mailte Joshua folgendes: Ok, You guys must be getting sick of these newbie questions, but I can't resist since I am learning a lot from these email lists and getting results quick! Thanks to

Re: [SQL] yet another simple SQL question

2007-06-26 Thread Achilleas Mantzios
Στις Τρίτη 26 Ιούνιος 2007 09:40, ο/η John Summerfield έγραψε: Joshua wrote: Ok, You guys must be getting sick of these newbie questions, but I can't resist since I am learning a lot from these email I'm not fond of people using meaningless subjects, or of people simultaneously posting

Re: [SQL] Transactions and Exceptions

2007-06-26 Thread Bart Degryse
Richard Huxton [EMAIL PROTECTED] 2007-06-22 19:00 Bart Degryse wrote: 2. Using dblink / dbi-link to reconnect to the database, which means your logging will take place in its own transaction. This I like more. Though I don't use either dblink nor dbi-link, I do use this kind of 'double'

[SQL] Where clause

2007-06-26 Thread Michael Landin Hostbaek
Hello, I have a table called tracking, with a contactid varchar, click bool, view bool and cid varchar. I would like to put the following into one single query if possible: // Number of clicks select cid,count(distinct contactid) from tracking where click = true group by cid; // Number of

Re: [SQL] Where clause

2007-06-26 Thread A. Kretschmer
am Tue, dem 26.06.2007, um 10:24:05 +0200 mailte Michael Landin Hostbaek folgendes: Hello, I have a table called tracking, with a contactid varchar, click bool, view bool and cid varchar. I would like to put the following into one single query if possible: // Number of clicks select

Re: [SQL] Where clause

2007-06-26 Thread Michael Landin Hostbaek
A. Kretschmer (andreas.kretschmer) writes: *untested* select cid, sum(case when click = true then 1 else 0 end), sum(case when view = true then 1 else 0 end) from ... Thanks, but I need the DISTINCT contactid - I don't want the same contactid counted twice. Mike

Re: [SQL] Where clause

2007-06-26 Thread Achilleas Mantzios
Στις Τρίτη 26 Ιούνιος 2007 12:44, ο/η Michael Landin Hostbaek έγραψε: A. Kretschmer (andreas.kretschmer) writes: *untested* select cid, sum(case when click = true then 1 else 0 end), sum(case when view = true then 1 else 0 end) from ... Thanks, but I need the DISTINCT contactid - I

Re: [SQL] Where clause

2007-06-26 Thread Richard Huxton
Michael Landin Hostbaek wrote: A. Kretschmer (andreas.kretschmer) writes: *untested* select cid, sum(case when click = true then 1 else 0 end), sum(case when view = true then 1 else 0 end) from ... Thanks, but I need the DISTINCT contactid - I don't want the same contactid counted twice.

Re: [SQL] yet another simple SQL question

2007-06-26 Thread Michael Glaesemann
On Jun 26, 2007, at 2:19 , Achilleas Mantzios wrote: Στις Τρίτη 26 Ιούνιος 2007 09:40, ο/η John Summerfield έγραψε: Subjects such as yours don't cut the mustard. Try to summarise your problem; if I'm interested in the problem then I will read it and (maybe) help. When I find it's

Re: [SQL] NO DATA FOUND Exception

2007-06-26 Thread Fernando Hevia
On Jun 25, 2007, at 17:05, Michael Glaesemann wrote: [Please create a new message to post about a new topic, rather than replying to and changing the subject of a previous message. This will allow mail clients which understand the References: header to properly thread replies.] Wasn't

Re: [SQL] NO DATA FOUND Exception

2007-06-26 Thread Bart Degryse
In case you would like to use set returning functions... if your function will return records with the same structure as an existing table CREATE FUNCTION my_func() RETURNS SETOF my_table AS ... if not you have to define the returning type CREATE TYPE func_row AS (field1 varchar(10), field2

Re: [SQL] NO DATA FOUND Exception

2007-06-26 Thread Fernando Hevia
Fernando Hevia [EMAIL PROTECTED] 2007-06-26 16:25 How do I refer a specific field of the returned row from outside the function? How should I write the query in order to show only fields 1 and 3, for example? In case you would like to use set returning functions...   if your function will

Re: [SQL] Vacation days

2007-06-26 Thread Wei Weng
On Monday 25 June 2007 15:22, Susan Young wrote: Hi Wei, That's OK - Enjoy! Susan Wei Weng wrote: Can I take next week off? Thanks! Wei hi, susan, a change of plan. :) Instead of the whole week, I just wanted to take next monday and tuesday off. Thanks! Wei

Re: [SQL] Vacation days

2007-06-26 Thread Alvaro Herrera
The same KMail bug that bit someone else just yesterday?? Enjoy the vacations anyway ... Wei Weng wrote: On Monday 25 June 2007 15:22, Susan Young wrote: Hi Wei, That's OK - Enjoy! Susan Wei Weng wrote: Can I take next week off? Thanks! Wei hi, susan, a change of

Re: [SQL] Vacation days

2007-06-26 Thread Jesper K. Pedersen
On Tue, 26 Jun 2007 13:04:14 -0400 Wei Weng [EMAIL PROTECTED] wrote: On Monday 25 June 2007 15:22, Susan Young wrote: Hi Wei, That's OK - Enjoy! Susan Wei Weng wrote: Can I take next week off? Thanks! Wei hi, susan, a change of plan. :) Instead of the whole week, I

Re: [SQL] Vacation days

2007-06-26 Thread Chris Browne
[EMAIL PROTECTED] (Wei Weng) writes: On Monday 25 June 2007 15:22, Susan Young wrote: Hi Wei, That's OK - Enjoy! Susan Wei Weng wrote: Can I take next week off? Thanks! Wei hi, susan, a change of plan. :) Instead of the whole week, I just wanted to take next monday and tuesday

[SQL] Delete rules and functions

2007-06-26 Thread Wiebe Cazemier
Hi, I have the following scenerio: a rule on a view which executes a function by means of a select call, which in turn deletes from a table which has on-delete rules on it. When the function is called from the rule, the subsequent delete call in the function doesn't cause the on-delete rules on

Re: [SQL] Where clause

2007-06-26 Thread news.gmane.org
Michael Landin Hostbaek skrev: Hello, I have a table called tracking, with a contactid varchar, click bool, view bool and cid varchar. I would like to put the following into one single query if possible: // Number of clicks select cid,count(distinct contactid) from tracking where

Re: [SQL] yet another simple SQL question

2007-06-26 Thread Andrej Ricnik-Bay
On 6/27/07, Michael Glaesemann [EMAIL PROTECTED] wrote: While self-admittedly grumpy, I believe John was trying to encourage better posting behavior from Joshua which will benefit him by receiving more answers. If John had remained silent (as I'm sure others who share his sentiment have), being

Re: [SQL] Delete rules and functions

2007-06-26 Thread Tom Lane
Wiebe Cazemier [EMAIL PROTECTED] writes: I have the following scenerio: a rule on a view which executes a function by means of a select call, which in turn deletes from a table which has on-delete rules on it. When the function is called from the rule, the subsequent delete call in the

Re: [SQL] Delete rules and functions

2007-06-26 Thread Wiebe Cazemier
On Tuesday 26 June 2007 22:50, Tom Lane wrote: Please provide an example, because the rewriter is most certainly applied to queries from functions. I suspect you are actually being burnt by some other effect, like a row disappearing from the view as soon as its underlying data is deleted.