I have two mysql tables: a. myTable1 and b. myTable2
First, I need to query the first table (myTable1) to get ‘custid’ and ‘age’ and then query the second table (myTable2) to get all the records that match any of the records in the intermediate result.
First query and the result look like as below:
select distinct custid,age from mtyTable1 where itemid in ( 2762 , 2763)
custid age
"8897953" 53.1839
"1433515" 49.5507
"7638023" 59.4099
"2310899" 46.8374
"6736604" 47.3001
Now, How to write an efficient nested query to search ‘myTable2’ to find all the records?
Try :