MySQL Forums
Forum List  »  Newbie

MYSQL left joins
Posted by: Gordon Stewart
Date: May 16, 2020 03:18AM

Hi, Ive looked at various tutorials for MYSQL left-joins using the same table. However I'm getting no results (or incorrect MYSQL errors).

This code below i found on a website/forum reply, But backed out of it & lost the URL

CODE:

SELECT
ca.*
FROM
categories ca
LEFT JOIN categories catwo
USING Reference
WHERE
ca.CATEGORY eq 'ACCOUNT'


1) "ACCOUNT" is a word/category i want to find in the CATEGORY field of the table
2) This will bring up a record with CATEGORY as a match & give me all fields.
3) using the matching 'Reference' - I'm wanting it to bring up all the other records that match the 'Reference'.

Currently i have only 3 records - one referece, but having 3 different categories.

(so far my PHP script is resulting in blank/no results. But the MYSQL conso;e says ive got an error in my SQL.)

Any advice welcome please.

Options: ReplyQuote


Subject
Written By
Posted
MYSQL left joins
May 16, 2020 03:18AM
May 16, 2020 03:54AM
May 16, 2020 08:36AM
May 16, 2020 05:44PM
May 16, 2020 06:06PM
May 16, 2020 06:16PM
May 16, 2020 06:22PM
May 16, 2020 06:27PM
May 16, 2020 07:12PM
May 16, 2020 07:20PM
May 16, 2020 07:29PM
May 17, 2020 01:11AM
May 17, 2020 08:36AM


Sorry, you can't reply to this topic. It has been closed.

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.