Subject | get data from table based on criteria from another table |
---|---|
Author | |
Post date | 2013-12-16T10:41:29Z |
Hi,
I have two tables, TABLE_A and TABLE_B
TABLE_A:
------
ID: INT
DATA_A: INT
TABLE_A data:
(ID, DATA_A)
1, 11
2, 12
3, 13
4, 14
9, 19
TABLE_B:
------
ID: INT
DATA_B: INT
TABLE_B data:
(ID, DATA_B)
1, 100
2, 200
3, 200
5, 100
7, 300
9, 100
I want to do the following: get all records from TABLE_A, for which ID exists in TABLE_B and DATA_B for that ID equals 100. Or in other words:
(1).from tableB, get all ID's for which DATA_B = 100 (here - 1,5,9), and then
(2).get all the records from TABLE_A containing an ID from(1)
In the above case, the desired result would be
1, 11
9, 19
Hope I explained it well.
Thanks for any suggestions.
Peter
I have two tables, TABLE_A and TABLE_B
TABLE_A:
------
ID: INT
DATA_A: INT
TABLE_A data:
(ID, DATA_A)
1, 11
2, 12
3, 13
4, 14
9, 19
TABLE_B:
------
ID: INT
DATA_B: INT
TABLE_B data:
(ID, DATA_B)
1, 100
2, 200
3, 200
5, 100
7, 300
9, 100
I want to do the following: get all records from TABLE_A, for which ID exists in TABLE_B and DATA_B for that ID equals 100. Or in other words:
(1).from tableB, get all ID's for which DATA_B = 100 (here - 1,5,9), and then
(2).get all the records from TABLE_A containing an ID from(1)
In the above case, the desired result would be
1, 11
9, 19
Hope I explained it well.
Thanks for any suggestions.
Peter