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 > )a

Re: [SQL] a wierd query

2004-05-18 Thread Stijn Vanroye
ple who replied (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]

Re: [SQL] a wierd query

2004-05-17 Thread Stephan Szabo
On Mon, 17 May 2004, Stijn Vanroye wrote: > 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 > select task_id, w

Re: [SQL] a wierd query

2004-05-17 Thread Stijn Vanroye
in a given period. This still 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 >

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 r

Re: [SQL] a wierd query

2004-05-17 Thread Stijn Vanroye
is question has risen. Kind regards, Stijn Vanroye > -Original Message- > From: Edmund Bacon [mailto:[EMAIL PROTECTED] > Sent: donderdag 13 mei 2004 17:28 > To: sad > Cc: [EMAIL PROTECTED] > Subject: Re: [SQL] a wierd query > > > sad wrote: > > select

Re: [SQL] a wierd query

2004-05-17 Thread Stijn Vanroye
2004 9:26 > To: [EMAIL 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 > ( > sel

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

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 DIST

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 broadcast)

Re: [SQL] a wierd query

2004-05-13 Thread Yasir Malik
IL PROTECTED]> > To: [EMAIL 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), >st

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 co

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 Achilleus Mantzios
SELECT foo.value from (select string_a as value from main_table UNION select string_b as value from main_table) as foo; O kyrios [EMAIL PROTECTED] egrapse stis May 13, 2004 : > hi > > i have a wierd problem and i require an equally weird query. > 1) backgound > Table test: > CREATE TABL

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

[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 main_table