3 Replies - 446 Views - Last Post: 20 April 2011 - 07:24 AM

#1 bluepoleinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-November 10

Problem selecting data from three tables

Posted 20 April 2011 - 06:23 AM

I am trying to select information from three tables and populate a form with the resulting data.

I have a query below which references the three tables but returns and error in my syntax.
SELECT * FROM `authentication`, `edit_content`, `websites` WHERE `authentication`.`id` = 1, `edit_content`.`owner_id` = 1, `websites`.`owner_id` = 1


Please can someone tell me where I am going wrong so that I can try and solve the problem.

Is This A Good Question/Topic? 0
  • +

Replies To: Problem selecting data from three tables

#2 Vishu Sukhdev  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 150
  • Joined: 19-February 10

Re: Problem selecting data from three tables

Posted 20 April 2011 - 06:33 AM

Hi,
SELECT a.*,b.*,c.* FROM authentication a 
INNER JOIN edit_content b 
ON a.id=b.owner_id 
INNER JOIN  websites c 
ON c.owner_id=a.id

Was This Post Helpful? 1
  • +
  • -

#3 bluepoleinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-November 10

Re: Problem selecting data from three tables

Posted 20 April 2011 - 06:40 AM

View PostVishu Sukhdev, on 20 April 2011 - 06:33 AM, said:

Hi,
SELECT a.*,b.*,c.* FROM authentication a 
INNER JOIN edit_content b 
ON a.id=b.owner_id 
INNER JOIN  websites c 
ON c.owner_id=a.id


Where you have put
a.*, b.*, c.*
are you referencing a table?
Was This Post Helpful? 0
  • +
  • -

#4 bluepoleinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-November 10

Re: Problem selecting data from three tables

Posted 20 April 2011 - 07:24 AM

View PostVishu Sukhdev, on 20 April 2011 - 06:33 AM, said:

Hi,
SELECT a.*,b.*,c.* FROM authentication a 
INNER JOIN edit_content b 
ON a.id=b.owner_id 
INNER JOIN  websites c 
ON c.owner_id=a.id



Worked great thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1