|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL query, selecting common values
Dear friends,
I have a table, say Table_1, which has 3 PK. Say P1, P2, P3. One more column is Id. The actual table contents are as - P1 P2 P3 Id 0 0 4 960 0 0 5 1 0 0 5 10 0 0 5 960 0 0 6 10 0 0 7 15033 0 0 8 10 0 0 8 960 0 0 8 92606 0 0 9 10 I can select more than one Id at a time. I have to select the common rows(while selecting more than one Ids). eg. Say Id 1 & 10 SELECT distinct Id_Prod_Grupo,Id_Prod_Tipo,Id_Prod_Pres from CVR_PRODUCTOS_TIENDA WHERE Id_Cliente in(1,10); It will return 4 rows, but I want only one row which is common to both Id 1 & 10. ie. 0 0 5 Can u pls help me out? |
|
#2
|
||||
|
||||
|
I don't exactly understand your table structure...
but would this help? Code:
SELECT distinct Id_Prod_Grupo,Id_Prod_Tipo,Id_Prod_Pres from CVR_PRODUCTOS_TIENDA WHERE Id_Cliente=1 OR Id_Cliente=10; What exactly do you mean by common rows? |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > SQL query, selecting common values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|