I am trying to get only one row from a child table for each parent row with child fields enabled, I tried with GRUOP BY, but without success :( Here is my original SELECT
SELECT pID, lastname
FROM parent
LEFT JOIN
(SELECT cID, pID, phone, company, title FROM child) as child
ON parent.pID = child.pID
Here is the strcture table
CREATE TABLE parent (
pID Counter(1,1) PRIMARY KEY,
firstname VarChar(24) DEFAULT '',
lastname VarChar(20) DEFAULT ''
);
CREATE TABLE child (
cID Counter(1,1) PRIMARY KEY,
pID int DEFAULT '0',
phone VarChar(16) DEFAULT '',
company VarChar(24) DEFAULT '',
title VarChar(24) DEFAULT '',
address TEXT
);
source
share