Re: [SQL] Syntax error while altering col-type

2005-01-13 Thread Sam Mason
KÖPFERL Robert wrote: >I'm a little bit perplexed now... is it really the case that pre 8.0 systems >aren't able to change col-types? I would guess that the column type altering code is just short hand for creating a new column of the correct type, copying the old column into the new one, deleting

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] Table definition

2004-11-16 Thread Sam Mason
Bruno Prévost wrote: >Anybody know how to obtain the table definition in text. Not quite sure if this is quite what you're after, but would: $ pg_dump -st foo help at all? It gives out the SQL that you would need to enter to re-create the table. Sam ---(end of bro

Re: [SQL] Comparing two (largish) tables on different servers

2004-11-10 Thread Sam Mason
Gregory S. Williamson wrote: >Is there any way to do this from inside postgres that anyone knows of >? I looked through the manual and the contrib stuff and didn't see >much ... Not really "inside postgres"; but could you do something like: mkfifo db1 psql -h "db1" -t -q -c "$query" > db1 m

Re: [SQL] Group by and aggregates

2004-11-07 Thread Sam Mason
Michael L. Hostbaek wrote: >Now, I need the first line to say "15.00" in the cmup field. That is, >stock and incoming are obviously not being grouped, but since it's the >same partno I'd like somehow to show the highest cmup. Is there some >black SQL voodoo that'll achieve this ? I think you need