sql - Result of one query into another query -


i have 2 tables table_a columnname column1 column2 column3 column4 column5 , has data

abc def ghi jkl mno

123 456 789 001 121

table_b columnname column6 column7 has data

column5 124

column4 bca

column3 aaa

column5 bbb

so have columnname of table_a data in table_b

so want in single query

$query1= select column6 table_b column7='aaa';

$query2= select $query1 table_a column1='123';

thanks

you need have value match table -> table b if looks this:

tablea -> id, name
tableb -> id, table_a_id, name

this query work:

select a.name, b.name tablea join tableb b on a.id=b.table_a_id , b.name='123' a.name='aaaa' 

to names of table , b. using alias table names here make easier read. hope, example, answer question.

if don't have matching values, want have columns crossed, can this:

select a.name, b.name tablea a, tableb b a.name='aaa' , b.name='123' 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -