V
V
Viktoria Smirnova2019-06-24 11:03:34
PostgreSQL
Viktoria Smirnova, 2019-06-24 11:03:34

SELECT PostgreSQL?

Guys, SQL is not strong at all, but you need to make a query of this nature:
you need to display the title of the question (new_question.title) from the answer table where (new_1answers.a) = 'no'
It seems not so difficult, but the output is always wrong.
Table with answers:

create table new_1answers
(
  id_report   integer
    constraint new_1answers_id_report_fkey
      references new_1report,
  id_question integer
    constraint new_1answers_id_question_fkey
      references new_question,
  a           varchar(8)
);

in "a" I write yes or no
a table with questions:
create table new_question
(
  id_question serial not null
    constraint new_question_pkey
      primary key,
  title       text
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman, 2019-06-24
@Vika7

SELECT *
FROM new_1answers
JOIN new_question ON new_question.id_question  = new_1answers.id_question 
WHERE new_1answers.a = 'no'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question