question 2

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

Hi again,
I have this query :
select prestito.*, libro.tipo,libro.id_libro from prestito,libro where
prestito.id_libro =
libro.id_libro_key
that return me (correct!):
id_libro|id_utente|data_prestito|visto|notifica1|notifica2|notifica3|tipo|id_libro
--------+---------+-------------+-----+---------+---------+---------+----+--------
12| 37| 12-04-1998|f | | | |
1|s1
13| 37| 12-04-1998|f | | | |
2|k1
(2 rows)

but if you see the item libro.id_libro is id_libro (s1,k1) and in the
prestito.*
there is another id_libro (11,12). Now I want to know how can I select
the second "id_lib
ro".

"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 2

The easiest way is to give it another name
select presto.*, libro.tipo, libro.id_libro as id_libro2 from ...
and just grab id_libro2 for the second id_libro.
You can also select it by column number in most interfaces.
-DEJ

Show quoted text

-----Original Message-----
From: ZioBudda [SMTP:michel@michel.enter.it]
Sent: Friday, December 04, 1998 12:06 PM
To: pgsql-general@postgreSQL.org
Subject: [GENERAL] question 2

Hi again,
I have this query :
select prestito.*, libro.tipo,libro.id_libro from prestito,libro where
prestito.id_libro =
libro.id_libro_key
that return me (correct!):
id_libro|id_utente|data_prestito|visto|notifica1|notifica2|notifica3|t
ipo|id_libro
--------+---------+-------------+-----+---------+---------+---------+-
---+--------
12| 37| 12-04-1998|f | | | |
1|s1
13| 37| 12-04-1998|f | | | |
2|k1
(2 rows)

but if you see the item libro.id_libro is id_libro (s1,k1) and in the
prestito.*
there is another id_libro (11,12). Now I want to know how can I
select
the second "id_lib
ro".

"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"