questions

From: ZioBudda <michel(at)michel(dot)enter(dot)it>
To: pgsql-general(at)postgreSQL(dot)org
Subject: questions
Date: 1998-10-20 20:57:08
Message-ID: Pine.LNX.4.03.9810202256230.6994-100000@michel.enter.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2 questions.

1)Hi, I have this 2 tables:
esame=> select * from libro_autore\g
id_libro|id_autore
--------+---------
s1 | 5
n3 | 1
n2 | 2
n1 | 1
n1 | 4

and
esame=> select * from autore\g
cognome|nome |data_nascita|luogo_nascita|id_autore
-------+----------+------------+-------------+---------
King |Stephen | 01-12-1940|NY | 1
Tamaro |Susanna | 15-02-1965|Milano | 2
Clancy |Tom | 05-05-1968|Los Angeles | 3
Straub |Peter | 01-01-1950|Milano | 4
Maraini|Dacia | 05-04-1962|Catania | 5
Zorza |Alessandra| 05-05-1974|Cernusco | 6

Now I want to found Cognome, Nome and number of books foreach "id_autore"
in
the libro_autore table.
I have think a SQL-statement like

SELECT a.cognome, a.nome,la.id_autore, count(*) from libro_autore la,
autore a group by l
a.id_autore\g

(ok this is not correct).
Any ideas ??

2)Now I have this table:
esame=> select * from view1\g
id_libro|id_utente|tipo
--------+---------+----
n3 | 9| 1
(1 row)

(for the moment only 1 item, but this table can contains more and more
items).
I want to find a way that return me for each "id_utente" the number of
books group by
"tipo".

"Il divertimento e' giusto se la scimmia ci prende gusto"
--
Italian Linux Meeting - http://www.pluto.linux.it/meeting/
--
Morelli 'ZioBudda' Davide Michel - Member of Pluto Linux User Group
michel(at)enter(dot)it - http://ziobudda.enter.it/
Linux Problem? Ask to linux(at)media(dot)dsi(dot)unimi(dot)it
"/dev/ziobudda: access to /var/tmp/beer denied, use /var/adm/pineapple"

Browse pgsql-general by date

  From Date Subject
Next Message Anand Surelia 1998-10-20 23:15:03 Sequences
Previous Message Peter T Mount 1998-10-20 20:40:42 Re: [GENERAL] jdbc + postgres