-3

This is my query:

SELECT 
      quote,topics,name,topic_en 
FROM 
     `topic`,`author`,`quote` 
WHERE   
     topics like '%Age%' 
     and topic_en= 'Age'
     and quote.author_id=author.id 

I have three tables:

  • Topic
  • Quote
  • author

  • topic table contains one field topic_en

  • author table contains name of author and
  • quote table contains quote and topics

I want the data from all these table. quote and topics from quote table,author name from author table and topic_en from topic table where topic_en is like topics of quote table and author id which is in quote table must be equal to id in author table. i have made above query which work partially not for all topic_en. Any help to get out from this.....

user4035
  • 22,508
  • 11
  • 59
  • 94
Ali
  • 23
  • 7

1 Answers1

0

Convert it to INNER JOIN:

SELECT 
      quote,topics,name,topic_en 
FROM 
     `author`
INNER JOIN `quote` ON quote.author_id=author.id
INNER JOIN `topic` ON topic.??? = ???.???
WHERE   
     topics LIKE '%Age%' 
     AND topic_en= 'Age'

Replace the ??? with appropriate field in table topic and a field in either author or quote, to join the table topic with that table.

Does that help?

Ada Lovelace
  • 835
  • 2
  • 8
  • 20