From: | "Dan Wilson" <phpPgAdmin(at)acucore(dot)com> |
---|---|
To: | <herbie(at)nextearth(dot)com>, "pgsql-php" <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: Rows in tables... |
Date: | 2001-02-19 22:50:47 |
Message-ID: | 02c001c09ac6$6790d140$078353d8@danwilson |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
You may be looking for a query like this:
SELECT * FROM [table] ORDER BY random() LIMIT 1
This will automtically select a random row and only return 1 tuple. This
will cut down on your query time and the memory usage.
I don't know if that was what you are trying to do.
-Dan
> What is the easiest way to get the total number of
> rows in a table? I want to do a random pick from a
> table and need to know how many rows are in the
> table.
>
> Do I do a "SELECT * FROM table" and use the info
> from this, or will a select return all the data?
> This is where I'm hazy. Or does fetch_row actually
> return the data?
>
> Any help is appreciated,
> Herbie Pabst
>
From | Date | Subject | |
---|---|---|---|
Next Message | rno | 2001-02-19 23:01:28 | authentification / news script |
Previous Message | Dorin Grunberg | 2001-02-19 22:41:52 | Re: Rows in tables... |