Please post questions to the list. I'm forwarding this to the SQL
list, as I think it's probably most applicable. I don't know much
about the Oracle syntax you've used. Hopefully someone will be able
to help you.
On Mar 13, 2006, at 12:30 , min wrote:
Please help me one PostgreSQL Statem
Daniel CAUNE wrote:
SELECT aid, cat
FROM table, (
SELECT aid, max(weight) as weight
FROM table
GROUP BY aid) AS tablemaxweight
WHERE table.aid = tablemaxweight.aid
AND table.weight = tablemaxweight.aid;
There is a limit case you don't specify how to deal with, when two or mor
On Sunday 12 March 2006 11:29, chester c young wrote:
> --- Robert Paulsen <[EMAIL PROTECTED]> wrote:
> > One problem with the above is that the list of attributes is fixed. I
> > am looking for a way to assign new, previously undefined, attributes
>
> to
>
> > items without changing the table stru
--- Robert Paulsen <[EMAIL PROTECTED]> wrote:
> One problem with the above is that the list of attributes is fixed. I
> am looking for a way to assign new, previously undefined, attributes
to
> items without changing the table structure. Is it ever appropriate to
do
> the following?
> ...
There a
Michael Fuhr wrote:
SELECT DISTINCT ON (aid) aid, cat
FROM tablename
ORDER BY aid, weight DESC, cat;
Good pointer. I think this will solve my problem. :)
SELECT aid, cat
FROM tablename AS t
JOIN (SELECT aid, max(weight) AS weight
FROM tablename
GROUP BY aid) AS s USING (aid, weig
Here is a sample table:
item
item_id int
namechar
attrib1 char
attrib2 char
attrib3 char
One problem with the above is that the list of attributes is fixed. I am
looking for a way to assign new, previously undefined, attributes to items
without changing the table structure
Michael Fuhr wrote:
On Sun, Mar 12, 2006 at 12:34:57AM -0500, Jeffrey Melloy wrote:
Should be able to do this with a standard max() aggregate.
select aid, cat, max(weight)
from table
group by aid, cat;
That query returns the maximum weight for each (aid, cat) pair.
Against the exampl
> Hi,
>
> I need a special aggregation function. For instance, given the following
> table data:
>
>aid| cat | weight
> --+-+-
> a1 | Drama | 1
> a1 | Romance | 6
> a1 | Short | 1
> a1 | Other | 7
> a2 | Comedy | 1