KKOOLL
@KKOOLL
full stack-developer

Cоставить sql запрос?

5f8e32b84b2de482864375.jpeg
надо чтобы вывело поля1, поля2 из таблицы1, но отображался не код, а names из таблицы2 (поле1 и поле2 не равны)
  • Вопрос задан
  • 91 просмотр
Решения вопроса 1
@Alex_At_Net
Обращайтесь, помогу - https://t.me/codecraft_phd
Используйте альясы:

create table Table1 (Code int, Field1 int, Field2 int);
create table Table2 (Code int, names varchar(255));
insert into Table1 values (1, 1, 2);
insert into Table1 values (2, 2, 1);
insert into Table2 values (1, "names1");
insert into Table2 values (2, "names2");

select t2a.names, t2b.names from Table1 t1, Table2 t2a, Table2 t2b
where t1.Field1 = t2a.Code and t1.Field2 = t2b.Code;
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы