Not sure I have the whole picture. Without thinking it all the way
through I can suggest if your comments are dated, replace "comment_date"
with whatever you call your field and try the following:
(NOTE THE LEFT JOIN TOO)
SELECT `customer`.`name`, `comments`.`note`, MAX(comment_date) FROM
customer
LEFT JOIN `comments` ON `customer`.`id` = `comments`.`customer`
WHERE `customer`.`join_date` >= "2012-01-01 00:00:00"
ORDER BY `customer`.`join_date`
ASC
Gotta run!
JR
On Tue, 2012-02-21 at 18:00 -0500, admin wrote:
> I have an issue where I am joining a table on a table.
>
> The problem is the table I am joining has more than one row of matching
> data.
>
>
>
>
>
> SELECT `customer`.`name`, `comments`.`note` FROM customer
>
> INNER JOIN `comments` ON `customer`.`id` = `comments`.`customer`
>
> WHERE
>
> `customer`.`join_date` >= "2012-01-01 00:00:00"
>
> ORDER BY `customer`.`join_date`
>
> ASC
>
>
>
>
>
> I need to return all the customers and the last note for each customer
>
> But what I get is a list with the repeat of each customer for each note.
>
>
>
>
>

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.