Re: [SQL] a wierd query

2004-05-19 Thread Christoph Haller
select distinct on (date, employee_id) employee_id, date from ( select distinct on (begindate, employee_id) begindate as date, employ= ee_id from workhour UNION select distinct on (enddate, employee_id) enddate as date, employee_i= d from workhour )as dist

Re: [SQL] a wierd query

2004-05-18 Thread Stijn Vanroye
(and started the thread) are in place here. Kind regards, Stijn Vanroye -Original Message- From: Stephan Szabo [mailto:[EMAIL PROTECTED] Sent: maandag 17 mei 2004 17:01 To: Stijn Vanroye Cc: [EMAIL PROTECTED]; Edmund Bacon Subject: Re: [SQL] a wierd query On Mon, 17 May 2004

Re: [SQL] a wierd query

2004-05-17 Thread Stijn Vanroye
PROTECTED] Cc: 'Edmund Bacon' Subject: RE: [SQL] a wierd query Are you sure about that Edmund? I have the following query: select distinct on (task_id, date) task_id, workhour_id, date from ( select task_id, workhour_id, begindate as date from workhour UNION

Re: [SQL] a wierd query

2004-05-17 Thread sad
I forgot one situation: if I run the query like so: select distinct on (task_id, begindate) task_id, workhour_id, begindate as date from workhour UNION select distinct on (task_id, enddate) task_id, workhour_id, enddate as date from workhour I get yet another value: 2961 rows.

Re: [SQL] a wierd query

2004-05-17 Thread Stijn Vanroye
keeps my question open wether or not a UNION does only show unique values in the union. -Original Message- From: sad [mailto:[EMAIL PROTECTED] Sent: maandag 17 mei 2004 9:13 To: [EMAIL PROTECTED] Subject: Re: [SQL] a wierd query I forgot one situation: if I run the query

Re: [SQL] a wierd query

2004-05-13 Thread Edmund Bacon
sad wrote: select distinct a as F from table union select distinct b as F from table; Note that UNION only returns the unique values of the union You can get repeated values by using UNION ALL. -- Edmund Bacon [EMAIL PROTECTED] ---(end of

[SQL] a wierd query

2004-05-13 Thread [EMAIL PROTECTED]
hi i have a wierd problem and i require an equally weird query. 1) backgound Table test: CREATE TABLE main_table ( string_A varchar( 20), string_B varchar( 20), ); -- both columns are identical in nature and usage INSERT INTO

Re: [SQL] a wierd query

2004-05-13 Thread Silke Trißl
[EMAIL PROTECTED] schrieb: hi i have a wierd problem and i require an equally weird query. 1) backgound Table test: CREATE TABLE main_table ( string_A varchar( 20), string_B varchar( 20), ); -- both columns are identical in nature and usage

Re: [SQL] a wierd query

2004-05-13 Thread sad
i require the dictinct values from (visualizing each column result as a set) the union of the two columns select distinct a as F from table union select distinct b as F from table; ---(end of broadcast)--- TIP 7: don't forget to increase your

Re: [SQL] a wierd query

2004-05-13 Thread Peter Childs
On Thu, 13 May 2004, [EMAIL PROTECTED] wrote: hi i have a wierd problem and i require an equally weird query. 1) backgound Table test: CREATE TABLE main_table ( string_A varchar( 20), string_B varchar( 20), ); -- both columns are

Re: [SQL] a wierd query

2004-05-13 Thread Yasir Malik
PROTECTED] Subject: [SQL] a wierd query hi i have a wierd problem and i require an equally weird query. 1) backgound Table test: CREATE TABLE main_table ( string_A varchar( 20), string_B varchar( 20), ); -- both columns are identical

Re: [SQL] a wierd query

2004-05-13 Thread sad
On Thursday 13 May 2004 19:27, you wrote: sad wrote: select distinct a as F from table union select distinct b as F from table; Note that UNION only returns the unique values of the union You can get repeated values by using UNION ALL. read the original problem look at the DISTINCT

Re: [SQL] a wierd query

2004-05-13 Thread Stephan Szabo
On Fri, 14 May 2004, sad wrote: On Thursday 13 May 2004 19:27, you wrote: sad wrote: select distinct a as F from table union select distinct b as F from table; Note that UNION only returns the unique values of the union You can get repeated values by using UNION ALL. read the