|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Hello,
I'm not sure if this can be done using a sql, but I'm trying to select the userids of the rows that doesn't have a certain value, in this example, I want to select the userid who didn't order any pencils, so if they had ordered something else and some pencils, I do not want these rows. so in this example, I would like to select only userid 2 (and only one row is desired to be returned); is this possible with sql? thank you in advance! userid item price -------- ----------- ------ 1 pen .25 1 pencil .15 1 eraser .50 2 pen .25 2 eraser .50 3 pen .25 3 pencil .15 3 eraser .50 |
|
#2
|
|||
|
|||
|
PHP Code:
|
|
#3
|
|||
|
|||
|
you can also write the following query:
SELECT DISTINCT userid from table1 WHERE item_name NOT IN ('pencil','eraser','pen') / |
|
#4
|
|||
|
|||
|
thanks very much guys.
I like hedge's solution better simply because I don't know what other kinds of items a customer could potentially buy. I did however added in the "distinct" clause. thanks again guys!!!! this forum is wonderful! - Sammy |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > query help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|