Re: Simple Query HELP!!!

Поиск
Список
Период
Сортировка
От 71062.1056@compuserve.com (--CELKO--)
Тема Re: Simple Query HELP!!!
Дата
Msg-id c0d87ec0.0109231949.4080c0a1@posting.google.com
обсуждение исходный текст
Ответ на Simple Query HELP!!!  (bulk@colonnello.org (Paolo Colonnello))
Список pgsql-sql
Please write DDL and not narrative.  here is my guess at what you are
trying to do.  What you posted was not a table because you had no key.TEXT is not the datatype to use for names --
unlessthey are thousand
 
of characters long!!
Recording age as an integer is useless -- give us the birthday and we
can always compute their age.  Is this what you meant to post?

CREATE TABLE People
(name CHAR(30) NOT NULL PRIMARY KEY, -- not big enough for TEXTage INTEGER NOT NULL, -- should be birthdate
insteadcompanyCHAR(30) NOT NULL);
 

>> ... create a query than get me a list with the seniors per company,
for example :<<


SELECT P1.name, P1.age, P1.company FROM People AS P1WHERE NOT EXISTS       (SELECT *         FROM People AS P2
WHEREP1.company = P2.company          AND P1.age < P2.age);
 
This says there is nobody older than the P1 person in the same
company.


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: A simple join question that may stump you
Следующее
От: domingo@dad-it.com (Domingo Alvarez Duarte)
Дата:
Сообщение: A bug in triggers PG 7.1.3 or misunderstand ?