Re: [SQL] Problems with HAVING

2005-01-12 Thread Kaloyan Iliev Iliev
Thank You, That's what I need. I know it was something simple but... Now it works perfectly. Thank's again. Kaloyan Iliev Michael Fuhr wrote: On Wed, Jan 12, 2005 at 10:11:21AM -0700, Michael Fuhr wrote: On Wed, Jan 12, 2005 at 06:38:51PM +0200, Kaloyan Iliev Iliev wrote: My problem is that

Re: [SQL] Problems with HAVING

2005-01-12 Thread Kaloyan Iliev Iliev
Thanks for the replay first. Yes I use "having" like I have written. I can't use your query because in subquery I must write again the whole WHERE clause. But in the other mail in the tread there is the solution:) Thanks again Kaloyan Sam Mason wrote: Kaloyan Iliev Iliev wrote: select test.nam

Re: [SQL] Problems with HAVING

2005-01-12 Thread Michael Fuhr
On Wed, Jan 12, 2005 at 10:11:21AM -0700, Michael Fuhr wrote: > On Wed, Jan 12, 2005 at 06:38:51PM +0200, Kaloyan Iliev Iliev wrote: > > > My problem is that I want to select the row with max(date) but also > > limited with where clauses. > > If you don't mind using a non-standard feature then t

Re: [SQL] Problems with HAVING

2005-01-12 Thread Sam Mason
Kaloyan Iliev Iliev wrote: >select test.name >from test >where test.name = foo.name >having max(test.date) I don't think you use the "having" clause like you've done there. I think you want to be doing something more like: select test.name from test where test.name = foo.name and t

Re: [SQL] Problems with HAVING

2005-01-12 Thread Michael Fuhr
On Wed, Jan 12, 2005 at 06:38:51PM +0200, Kaloyan Iliev Iliev wrote: > My problem is that I want to select the row with max(date) but also > limited with where clauses. If you don't mind using a non-standard feature then try SELECT DISTINCT ON (not just DISTINCT, but DISTINCT ON): http://www.po

[SQL] Problems with HAVING

2005-01-12 Thread Kaloyan Iliev Iliev
Hello, My problem is that I want to select the row with max(date) but also limited with where clauses. Select test.name from  test where test.name = foo.name having max(test.date) This is a subquery and is part bigger query. How I can select the row with the max query. ERROR: argument of