|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with sql query
Hi,
Can anyone please suggest a query I could use to extract all customers in the following sample table who have products "standard", "variable" and "offset" (all 3 products)? Table: Client Client_Id.....Product --------.....-------- 1...............Standard 1...............Variable 1...............Offset 2...............Redraw 2...............Interest 3...............Principal ... Thanks. |
|
#2
|
|||
|
|||
|
One way:
Code:
select distinct client_id from client a where exists (select 'X' from client b where a.client_id=b.client_id and product='Standard') and exists (select 'X' from client b where a.client_id=b.client_id and product='Offset') and exists (select 'X' from client b where a.client_id=b.client_id and product='Variable') ; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Help with sql query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|