question 3

Started by ZioBuddaover 27 years ago4 messagesgeneral
Jump to latest
#1ZioBudda
michel@michel.enter.it

Hi again,
I have this 3 tables:
esame=> select * from prestito\g
id_libro|id_utente|data_prestito|visto|notifica1|notifica2|notifica3
--------+---------+-------------+-----+---------+---------+---------
11| 37| 12-04-1998|f | | |
(1 row)

esame=> select * from utente\g
cognome |nome |id_utente|indirizzo |
telefono|tipo_utente|info_utente |l
ibri_presi| notifica1| notifica2| notifica3|password|email
--------+--------+---------+----------------+------------+-----------+------------------+-
----------+----------+----------+----------+--------+--------------
Ballabio|Dario | 37|Via carducci 125| 02-2422700|
1|Ditta Enter S.r.L.|
| | | |dario |dario@pinco.it

esame=> select * from libro\g
titolo |id_libro|id_utente|collocazione|casa_edit|
data_publ|tipo|difetto|id_libro_ke
y
------------+--------+---------+------------+---------+----------+----+-------+-----------
-
Il talismano|s1 | 0|d1 |aop2 |05-12-1985| 1|
| 1
2
It |d1 | 37|d1 |apo |05-12-1940| 1|
| 1
1

I need a query that for each id_utente return me the numeber of items in
"prestito" and th
is number is group by libro.tipo

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

#2Jackson, DeJuan
djackson@cpsgroup.com
In reply to: ZioBudda (#1)
RE: [GENERAL] question 3

I really have no idea what you are truly asking for here, but here's a
crack at what I think you want.
select count(p.*) from prestito p, libro l
where p.id_libro = l.id_libro
group by p.id_utente, l.tipo
Try it...
-DEJ

Show quoted text

-----Original Message-----
Hi again,
I have this 3 tables:
esame=> select * from prestito\g
id_libro|id_utente|data_prestito|visto|notifica1|notifica2|notifica3
--------+---------+-------------+-----+---------+---------+---------
11| 37| 12-04-1998|f | | |
(1 row)

esame=> select * from utente\g
cognome |nome |id_utente|indirizzo |
telefono|tipo_utente|info_utente |l
ibri_presi| notifica1| notifica2| notifica3|password|email
--------+--------+---------+----------------+------------+-----------+
------------------+-
----------+----------+----------+----------+--------+--------------
Ballabio|Dario | 37|Via carducci 125| 02-2422700|
1|Ditta Enter S.r.L.|
| | | |dario |dario@pinco.it

esame=> select * from libro\g
titolo      |id_libro|id_utente|collocazione|casa_edit|
data_publ|tipo|difetto|id_libro_ke
y
------------+--------+---------+------------+---------+----------+----
+-------+-----------
-
Il talismano|s1      |        0|d1          |aop2     |05-12-1985|
1|
|          1
2
It          |d1      |       37|d1          |apo      |05-12-1940|
1|
|          1
1

I need a query that for each id_utente return me the numeber of items
in
"prestito" and th
is number is group by libro.tipo

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

#3ZioBudda
michel@michel.enter.it
In reply to: Jackson, DeJuan (#2)
RE: [GENERAL] question 3

On Fri, 4 Dec 1998, Jackson, DeJuan wrote:

I really have no idea what you are truly asking for here, but here's a
crack at what I think you want.
select count(p.*) from prestito p, libro l
where p.id_libro = l.id_libro
group by p.id_utente, l.tipo
Try it...

parser: parse error at or near "*"

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

#4Jackson, DeJuan
djackson@cpsgroup.com
In reply to: ZioBudda (#3)
RE: [GENERAL] question 3

-----Original Message-----
From: ZioBudda [SMTP:michel@michel.enter.it]
Sent: Friday, December 04, 1998 4:44 PM
To: Jackson, DeJuan
Cc: pgsql-general@postgreSQL.org
Subject: RE: [GENERAL] question 3

On Fri, 4 Dec 1998, Jackson, DeJuan wrote:

I really have no idea what you are truly asking for here, but here's

a

crack at what I think you want.
select count(p.*) from prestito p, libro l
where p.id_libro = l.id_libro
group by p.id_utente, l.tipo
Try it...

parser: parse error at or near "*"

sub the * with any column from p this is not NULL.

Show quoted text

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