Обсуждение:
I would like clarification on the first paragraph of section 9.20.2 on the page at http://www.postgresql.org/docs/9.1/static/functions-subquery.html regarding the syntax of the 'expression in (subquery)' clause. What is meant by The right-hand side is a parenthesized subquery, which must return exactly one column. ? Appears to me that the subquery must only contain the same number of columns as the left hand side, not just 1 column. thanks-j
well, it seems to me that section 9.20.2 makes sense.
http://www.w3schools.com/sql/sql_in.asp
I am not sure that you can compare multiple columns such as in:
SELECT * FROM Persons WHERE LastName, FirstName IN (SELECT LastName, FirstName FROM OtherPersons);
if this is what you mean, at least not using this method, which returns an error.
d
Le 15/11/11 18:29, jmscott@setspace.com a écrit :
http://www.w3schools.com/sql/sql_in.asp
I am not sure that you can compare multiple columns such as in:
SELECT * FROM Persons WHERE LastName, FirstName IN (SELECT LastName, FirstName FROM OtherPersons);
if this is what you mean, at least not using this method, which returns an error.
d
Le 15/11/11 18:29, jmscott@setspace.com a écrit :
I would like clarification on the first paragraph of section 9.20.2 on the page at http://www.postgresql.org/docs/9.1/static/functions-subquery.html regarding the syntax of the 'expression in (subquery)' clause. What is meant by The right-hand side is a parenthesized subquery, which must return exactly one column. ? Appears to me that the subquery must only contain the same number of columns as the left hand side, not just 1 column. thanks-j
here is a trivial example in 9.1 jmscott=> select (1, 2) in (select 1, 2); ?column? ---------- t (1 row) where the right hand side returns 2 columns, not exactly one column, contradicting what the docs say: >> The right-hand side is a parenthesized subquery, which must return >> exactly one column. seems like a documentation error. what am i missing? -j > well, it seems to me that section 9.20.2 makes sense. > http://www.w3schools.com/sql/sql_in.asp > I am not sure that you can compare multiple columns such as in: > > SELECT * FROM Persons WHERE LastName, FirstName IN (SELECT LastName, > FirstName FROM OtherPersons); > > if this is what you mean, at least not using this method, which returns > an error. > > d > > Le 15/11/11 18:29, jmscott@setspace.com a écrit : >> I would like clarification on the first paragraph of section 9.20.2 on >> the page at >> >> http://www.postgresql.org/docs/9.1/static/functions-subquery.html >> >> regarding the syntax of the 'expression in (subquery)' clause. >> >> What is meant by >> >> The right-hand side is a parenthesized subquery, which must return >> exactly one column. >> >> ? Appears to me that the subquery must only contain the same number of >> columns as the left hand side, not just 1 column. >> >> thanks-j >> >> > > >
Right, I am probably wrong. Some other opinion?
d
Le 15/11/11 19:48, jmscott@setspace.com a écrit :
d
Le 15/11/11 19:48, jmscott@setspace.com a écrit :
here is a trivial example in 9.1 jmscott=> select (1, 2) in (select 1, 2);?column? ----------t (1 row) where the right hand side returns 2 columns, not exactly one column, contradicting what the docs say:The right-hand side is a parenthesized subquery, which must return exactly one column.seems like a documentation error. what am i missing? -jwell, it seems to me that section 9.20.2 makes sense. http://www.w3schools.com/sql/sql_in.asp I am not sure that you can compare multiple columns such as in: SELECT * FROM Persons WHERE LastName, FirstName IN (SELECT LastName, FirstName FROM OtherPersons); if this is what you mean, at least not using this method, which returns an error. d Le 15/11/11 18:29, jmscott@setspace.com a écrit :I would like clarification on the first paragraph of section 9.20.2 on the page at http://www.postgresql.org/docs/9.1/static/functions-subquery.html regarding the syntax of the 'expression in (subquery)' clause. What is meant by The right-hand side is a parenthesized subquery, which must return exactly one column. ? Appears to me that the subquery must only contain the same number of columns as the left hand side, not just 1 column. thanks-j
--
Baux David
Ingénieur bioinformatique
Groupe neurosensoriel (site web)
Laboratoire de Génétique Moléculaire - CHU
IURC, Institut Universitaire de Recherche Clinique
UFR Médecine Site NORD UPM/IURC
641 Avenue du Doyen Giraud
34093 MONTPELLIER Cedex 5
Nouveau numéro:
04 11 75 98 76