Re: [SQL] is it possible to get the number of rows of a table?
I would like to compare the number of rows of one table and of another and use it in a query like this: SELECT * FROM WHERE number of rows of table EQUALS number of rows of table i.e. I only want get a query result if the tables have the same number of rows. Is there a function or a way to do this ? Thanks, Frederick Basically, the way to find out about the number of rows of a table is select count(*) from t1 But the select statement above looks odd to me (no offence intended). To receive a selection of certain rows of a table you have to reference at least one column of that table in the where clause like in select * from table1 t1 where t1.c1 = (select count(*) from t2) I hope this helps at least a bit. Regards, Christoph ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
[SQL] is it possible to get the number of rows of a table?
I would like to compare the number of rows of one table and of another and use it in a query like this: SELECT * FROM WHERE number of rows of table EQUALS number of rows of table i.e. I only want get a query result if the tables have the same number of rows. Is there a function or a way to do this ? Thanks, Frederick __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [SQL] is it possible to get the number of rows of a table?
This should be really easy to implement in a function yourself. And I don't think there is already something similar in pgsql. == Wei Weng Network Software Engineer KenCast Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Frederick Klauschen Sent: Wednesday, September 26, 2001 11:15 AM To: [EMAIL PROTECTED] Subject: [SQL] is it possible to get the number of rows of a table? I would like to compare the number of rows of one table and of another and use it in a query like this: SELECT * FROM WHERE number of rows of table EQUALS number of rows of table i.e. I only want get a query result if the tables have the same number of rows. Is there a function or a way to do this ? Thanks, Frederick __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED]) ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html