Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7616035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:47:33+00:00 2026-05-31T02:47:33+00:00

I’m having problems trying to get a query like this table answers CREATE TABLE

  • 0

I’m having problems trying to get a query like this

table answers

CREATE TABLE IF NOT EXISTS `rws_answers` (
  `id_answer` int(11) NOT NULL AUTO_INCREMENT,
  `id_question` int(11) DEFAULT NULL,
  `row_subject` varchar(255) NOT NULL,
  `column_subject` varchar(255) DEFAULT NULL,
  `answer_type` varchar(1) DEFAULT NULL,
  `score` int(5) DEFAULT '0',
  PRIMARY KEY (`id_answer`),
  KEY `IDX_51C8C33DE62CA5DB` (`id_question`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=765 ;

table reviews

CREATE TABLE IF NOT EXISTS `rws_reviews` (
  `id_review` int(11) unsigned NOT NULL,
  `id_client` varchar(36) NOT NULL DEFAULT '',
  `id_item` int(11) unsigned NOT NULL DEFAULT '0',
  `id_question` int(11) unsigned NOT NULL DEFAULT '0',
  `id_location` int(11) unsigned NOT NULL DEFAULT '0',
  `id_answer` int(11) unsigned NOT NULL DEFAULT '0',
  `value` text,
  `date_answered` datetime NOT NULL,
   PRIMARY KEY (`id_review`,`id_client`,`id_item`,`id_question`,`id_location`,`id_answer`),
  KEY `IDX_6868EE34943B391C` (`id_item`),
  KEY `IDX_6868EE34E62CA5DB` (`id_question`),
  KEY `IDX_6868EE34E45655E` (`id_location`),
  KEY `IDX_6868EE34FCEAFFC8` (`id_answer`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

what I need is to get all the id_answer in table answers that are and aren’t in table reviews
so if I try this sql

SELECT r.id_review, a.id_answer AS aa, r.id_answer AS ra, a.row_subject, r.id_location
FROM rws_answers a 
LEFT JOIN rws_reviews r USING(id_answer)
ORDER BY a.id_answer DESC

I get those rows, but because the reviews table can have different id_location I need to filter them so I add to the query this

SELECT r.id_review, a.id_answer AS aa, r.id_answer AS ra, a.row_subject, r.id_location
FROM rws_answers a 
LEFT JOIN rws_reviews r USING(id_answer)
WHERE r.id_location = 1
ORDER BY a.id_answer DESC

but then all my answers that aren’t in reviews table don’t show anymore, I had try any sort of combination without result, can anyone be so kind to try to help me out or maybe suggest me a different way of doing the query, I have more than 3 day trying, readying, doing example, don’t know what else to do, thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:47:34+00:00Added an answer on May 31, 2026 at 2:47 am

    You can convert the USING clause to an ON clause, and merge the WHERE clause into it:

    LEFT JOIN rws_reviews r ON r.id_answer = a.id_answer AND r.id_location = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have some data like this: 1 2 3 4 5 9 2 6
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.