Обсуждение: RE: [GENERAL] No MAX function
SET QUERY_LIMIT TO restricts the number of rows returned. I want to determine the largest value in a column. Sorry if my question was unclear, I am new to %SQL. Jonny -----Original Message----- From: Neil Burrows [mailto:maillist@remo.demon.co.uk] Sent: Saturday, February 06, 1999 1:51 PM To: Jonny Hinojosa Cc: psql-general@postgresql.org Subject: RE: [GENERAL] No MAX function Hi, I believe there is a patch in "contrib" directory that does this, but if you have Postgres 6.4 then have a look at the SET QUERY_LIMIT TO command. Regards, ---[ Neil Burrows ]----------------------------------------------------- E-mail: neil@pawprint.co.uk ** This e-mail was ** Web : http://www.remo.demon.co.uk/ ** Made in Scotland ** -------< PGP Key available from http://www.remo.demon.co.uk/pgp/ >-------- > -----Original Message----- > From: owner-pgsql-general@postgreSQL.org > [mailto:owner-pgsql-general@postgreSQL.org]On Behalf Of Jonny Hinojosa > Sent: 06 February 1999 19:13 > To: PostGreSQL Mailing List > Subject: [GENERAL] No MAX function > > > Does anyone have a work around for the lack of a MAX function ? I need to > find the last record WHERE a LIKE 'x' AND b LIKE 'y'. > > Jonny Hinojosa > TCA Internet > Jonny@TCA.net > 409.693.8885 > >
On Sat, 6 Feb 1999, Jonny Hinojosa wrote: select * from events where event_id=(select max(event_id) from events); That works in my event database. // SET QUERY_LIMIT TO restricts the number of rows returned. I want to // determine the largest value in a column. Sorry if my question was unclear, // I am new to %SQL. // // Jonny // // -----Original Message----- // From: Neil Burrows [mailto:maillist@remo.demon.co.uk] // Sent: Saturday, February 06, 1999 1:51 PM // To: Jonny Hinojosa // Cc: psql-general@postgresql.org // Subject: RE: [GENERAL] No MAX function // // // Hi, // // I believe there is a patch in "contrib" directory that does this, but if you // have Postgres 6.4 then have a look at the // // SET QUERY_LIMIT TO // // command. // // Regards, // // ---[ Neil Burrows ]----------------------------------------------------- // E-mail: neil@pawprint.co.uk ** This e-mail was ** // Web : http://www.remo.demon.co.uk/ ** Made in Scotland ** // -------< PGP Key available from http://www.remo.demon.co.uk/pgp/ >-------- // // // // > -----Original Message----- // > From: owner-pgsql-general@postgreSQL.org // > [mailto:owner-pgsql-general@postgreSQL.org]On Behalf Of Jonny Hinojosa // > Sent: 06 February 1999 19:13 // > To: PostGreSQL Mailing List // > Subject: [GENERAL] No MAX function // > // > // > Does anyone have a work around for the lack of a MAX function ? I need to // > find the last record WHERE a LIKE 'x' AND b LIKE 'y'. // > // > Jonny Hinojosa // > TCA Internet // > Jonny@TCA.net // > 409.693.8885 // > // > // // // -- Principal Member Technical Staff, beyond.com The world is watching America, pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L______________________________________________ and America is watching TV. __
On v6.4.2, I get : cdmwhere=> SELECT * FROM traplog WHERE millisid= (SELECT MAX(millisid) FROM traplog WHERE esn LIKE '0f:11:19:82:54:35'); ERROR: No such function 'max' with the specified attributes cdmwhere=> Jonny -----Original Message----- From: dustin sallings [mailto:dustin@spy.net] Sent: Saturday, February 06, 1999 2:21 PM To: Jonny Hinojosa Cc: PostGreSQL Mailing List Subject: RE: [GENERAL] No MAX function On Sat, 6 Feb 1999, Jonny Hinojosa wrote: select * from events where event_id=(select max(event_id) from events); That works in my event database. // SET QUERY_LIMIT TO restricts the number of rows returned. I want to // determine the largest value in a column. Sorry if my question was unclear, // I am new to %SQL. // // Jonny // // -----Original Message----- // From: Neil Burrows [mailto:maillist@remo.demon.co.uk] // Sent: Saturday, February 06, 1999 1:51 PM // To: Jonny Hinojosa // Cc: psql-general@postgresql.org // Subject: RE: [GENERAL] No MAX function // // // Hi, // // I believe there is a patch in "contrib" directory that does this, but if you // have Postgres 6.4 then have a look at the // // SET QUERY_LIMIT TO // // command. // // Regards, // // ---[ Neil urrows ]----------------------------------------------------- // E-mail: neil@pawprint.co.uk ** This e-mail was ** // Web : http://www.remo.demon.co.uk/ ** Made in Scotland ** // -------< PGP Key available from http://www.remo.demon.co.uk/pgp/ >-------- // // // // > -----Original Message----- // > From: owner-pgsql-general@postgreSQL.org // > [mailto:owner-pgsql-general@postgreSQL.org]On Behalf Of Jonny Hinojosa // > Sent: 06 February 1999 19:13 // > To: PostGreSQL Mailing List // > Subject: [GENERAL] No MAX function // > // > // > Does anyone have a work around for the lack of a MAX function ? I need to // > find the last record WHERE a LIKE 'x' AND b LIKE 'y'. // > // > Jonny Hinojosa // > TCA Internet // > Jonny@TCA.net // > 409.693.8885 // > // > // // // -- Principal Member Technical Staff, beyond.com The world is watching America, pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L______________________________________________ and America is watching TV. __
On Sat, 6 Feb 1999, Jonny Hinojosa wrote: // cdmwhere=> SELECT * FROM traplog WHERE millisid= // (SELECT MAX(millisid) FROM traplog // WHERE esn LIKE '0f:11:19:82:54:35'); // ERROR: No such function 'max' with the specified attributes // cdmwhere=> What's a millisid? If it's something obscure, there may not have been a max() defined for it. // // -----Original Message----- // From: dustin sallings [mailto:dustin@spy.net] // Sent: Saturday, February 06, 1999 2:21 PM // To: Jonny Hinojosa // Cc: PostGreSQL Mailing List // Subject: RE: [GENERAL] No MAX function // // // On Sat, 6 Feb 1999, Jonny Hinojosa wrote: // // select * from events // where event_id=(select max(event_id) from events); // // That works in my event database. // // // SET QUERY_LIMIT TO restricts the number of rows returned. I want to // // determine the largest value in a column. Sorry if my question was // unclear, // // I am new to %SQL. // // // // Jonny // // // // -----Original Message----- // // From: Neil Burrows [mailto:maillist@remo.demon.co.uk] // // Sent: Saturday, February 06, 1999 1:51 PM // // To: Jonny Hinojosa // // Cc: psql-general@postgresql.org // // Subject: RE: [GENERAL] No MAX function // // // // // // Hi, // // // // I believe there is a patch in "contrib" directory that does this, but if // you // // have Postgres 6.4 then have a look at the // // // // SET QUERY_LIMIT TO // // // // command. // // // // Regards, // // // // ---[ Neil // urrows ]----------------------------------------------------- // // E-mail: neil@pawprint.co.uk ** This e-mail was // ** // // Web : http://www.remo.demon.co.uk/ ** Made in Scotland // ** // // -------< PGP Key available from http://www.remo.demon.co.uk/pgp/ // >-------- // // // // // // // // > -----Original Message----- // // > From: owner-pgsql-general@postgreSQL.org // // > [mailto:owner-pgsql-general@postgreSQL.org]On Behalf Of Jonny Hinojosa // // > Sent: 06 February 1999 19:13 // // > To: PostGreSQL Mailing List // // > Subject: [GENERAL] No MAX function // // > // // > // // > Does anyone have a work around for the lack of a MAX function ? I need // to // // > find the last record WHERE a LIKE 'x' AND b LIKE 'y'. // // > // // > Jonny Hinojosa // // > TCA Internet // // > Jonny@TCA.net // // > 409.693.8885 // // > // // > // // // // // // // // -- // Principal Member Technical Staff, beyond.com The world is watching // America, // pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> // | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE // L______________________________________________ and America is watching TV. // __ // // // -- Principal Member Technical Staff, beyond.com The world is watching America, pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L______________________________________________ and America is watching TV. __
It depends of data type - unfortunately max was not defined for ALL appropriate types. Through testo=> select max(bypref) from inetspec; max --- 24 where bypref is int2. On Sat, 6 Feb 1999, dustin sallings wrote: > Date: Sat, 6 Feb 1999 13:10:56 -0800 (PST) > From: dustin sallings <dustin@spy.net> > To: Jonny Hinojosa <Jonny@TCA.net> > Cc: PostGreSQL Mailing List <pgsql-general@postgreSQL.org> > Subject: RE: [GENERAL] No MAX function > > On Sat, 6 Feb 1999, Jonny Hinojosa wrote: > > // cdmwhere=> SELECT * FROM traplog WHERE millisid= > // (SELECT MAX(millisid) FROM traplog > // WHERE esn LIKE '0f:11:19:82:54:35'); > // ERROR: No such function 'max' with the specified attributes > // cdmwhere=> > > What's a millisid? If it's something obscure, there may not have > been a max() defined for it. > > // > // -----Original Message----- > // From: dustin sallings [mailto:dustin@spy.net] > // Sent: Saturday, February 06, 1999 2:21 PM > // To: Jonny Hinojosa > // Cc: PostGreSQL Mailing List > // Subject: RE: [GENERAL] No MAX function > // > // > // On Sat, 6 Feb 1999, Jonny Hinojosa wrote: > // > // select * from events > // where event_id=(select max(event_id) from events); > // > // That works in my event database. > // > // // SET QUERY_LIMIT TO restricts the number of rows returned. I want to > // // determine the largest value in a column. Sorry if my question was > // unclear, > // // I am new to %SQL. > // // > // // Jonny > // // > // // -----Original Message----- > // // From: Neil Burrows [mailto:maillist@remo.demon.co.uk] > // // Sent: Saturday, February 06, 1999 1:51 PM > // // To: Jonny Hinojosa > // // Cc: psql-general@postgresql.org > // // Subject: RE: [GENERAL] No MAX function > // // > // // > // // Hi, > // // > // // I believe there is a patch in "contrib" directory that does this, but if > // you > // // have Postgres 6.4 then have a look at the > // // > // // SET QUERY_LIMIT TO > // // > // // command. > // // > // // Regards, > // // > // // ---[ Neil > // urrows ]----------------------------------------------------- > // // E-mail: neil@pawprint.co.uk ** This e-mail was > // ** > // // Web : http://www.remo.demon.co.uk/ ** Made in Scotland > // ** > // // -------< PGP Key available from http://www.remo.demon.co.uk/pgp/ > // >-------- > // // > // // > // // > // // > -----Original Message----- > // // > From: owner-pgsql-general@postgreSQL.org > // // > [mailto:owner-pgsql-general@postgreSQL.org]On Behalf Of Jonny Hinojosa > // // > Sent: 06 February 1999 19:13 > // // > To: PostGreSQL Mailing List > // // > Subject: [GENERAL] No MAX function > // // > > // // > > // // > Does anyone have a work around for the lack of a MAX function ? I need > // to > // // > find the last record WHERE a LIKE 'x' AND b LIKE 'y'. > // // > > // // > Jonny Hinojosa > // // > TCA Internet > // // > Jonny@TCA.net > // // > 409.693.8885 > // // > > // // > > // // > // // > // // > // > // -- > // Principal Member Technical Staff, beyond.com The world is watching > // America, > // pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> > // | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE > // L______________________________________________ and America is watching TV. > // __ > // > // > // > > -- > Principal Member Technical Staff, beyond.com The world is watching America, > pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> > | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE > L______________________________________________ and America is watching TV. __ > > > Aleksei Roudnev, Network Operations Center, Relcom, Moscow (+7 095) 194-19-95 (Network Operations Center Hot Line),(+7 095) 230-41-41, N 13729 (pager) (+7 095) 196-72-12 (Support), (+7 095) 194-33-28 (Fax)