learning_grexcel
Active Member
- Joined
- Jan 29, 2011
- Messages
- 319
Excel 2007
<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]2-Jun-12[/TD]
[TD="align: right"]33[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]3-Jun-12[/TD]
[TD="align: right"]76[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]4-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]5-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]6-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]7-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]9[/TD]
[TD="align: right"]8-Jun-12[/TD]
[TD="align: right"]11[/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]9-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]11[/TD]
[TD="align: right"]10-Jun-12[/TD]
[TD="align: right"]84[/TD]
</tbody>
In the above table, I want to list all the field1 which has corresponding field2 values both 85 and 84
I want output like below. As you can see here the field1 values have both 85 and 84 corresponding code.
Excel 2007
<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]7-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]9-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]10-Jun-12[/TD]
[TD="align: right"]84[/TD]
</tbody>
I tried the below query but it lists all field1 which exists either 85 or 84 but I want to list all field1 which has both 85 and 84.
A | B | C | |
---|---|---|---|
col_date | field1 | field2 | |
xyz | |||
abc | |||
xyz | |||
aasdf | |||
sdf | |||
abc | |||
xyz | |||
aasdf | |||
mmn | |||
mmn |
<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]2-Jun-12[/TD]
[TD="align: right"]33[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]3-Jun-12[/TD]
[TD="align: right"]76[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]4-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]5-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]6-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]7-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]9[/TD]
[TD="align: right"]8-Jun-12[/TD]
[TD="align: right"]11[/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]9-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]11[/TD]
[TD="align: right"]10-Jun-12[/TD]
[TD="align: right"]84[/TD]
</tbody>
Sheet1
In the above table, I want to list all the field1 which has corresponding field2 values both 85 and 84
I want output like below. As you can see here the field1 values have both 85 and 84 corresponding code.
Excel 2007
A | B | C | |
---|---|---|---|
col_date | field1 | field2 | |
xyz | |||
xyz | |||
mmn | |||
mmn |
<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]7-Jun-12[/TD]
[TD="align: right"]84[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]9-Jun-12[/TD]
[TD="align: right"]85[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]10-Jun-12[/TD]
[TD="align: right"]84[/TD]
</tbody>
Sheet2
I tried the below query but it lists all field1 which exists either 85 or 84 but I want to list all field1 which has both 85 and 84.
Code:
select col_date, field1, field2 from table1
where field2 = '85' or field2 = '84'