guys,
I have two tables:
Table 1:
UID NAME
1 Name1
2 Name2
3 Name3
Table 2:
UID PID PARAM
1 1 10
2 1 20
3 2 10
4 2 30
5 2 40
6 3 60
7 3 20
8 3 10
I need to join the two tables (t1.UID=t2.PID) and to list only the records from the first table, that have (for example) BOTH PARAM=10 AND PARAM=20 in the second table. This way, for this example, the query should return:
UID NAME
1 Name1
3 Name3
..because only Name1 AND Name3 have the BOTH PARAM=10 AND PARAM=20
How can I do this? I know it’s probably very simple, but I can’t find the answer nor here, neither in google.
Thank you in advance!
Ned
by declaring your table
table1 a, you can call any columnfrom this table by putting the tables declared name in from of the columna.name