JORGE MALDONADO wrote:
> I have a parent and child tables and need to get "n" records from parent table
> and all of the records in child for such "n" records in parent. What can be a good approach?
I'd try it as follows:
SELECT ...
FROM (SELECT p_id, ... FROM parent LIMIT 42) p JOIN child c USING (p_id);
This assumes that "p_id" is the key column in "parent"
and the foreign key column in "child".
Yours,
Laurenz Albe
--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice