Re: Help writing SQL statement in PHP script
Jerry Stuckle wrote:
> Chuck Cheeze wrote:
>> This might be in the wrong group, but...
>>
>> Here is an example of my data:
>>
>> entry_id cat_id
>> 1 20
>> 2 25
>> 3 30
>> 4 25
>> 5 35
>> 6 25
>> 2 30
>> 2 35
>> 3 35
>>
>> As you can see, entry_id's 2 and 3 both belong to cat_id 30 and 35
>>
>> I have captured the cat_id's 30 and 35 with my script, so I need all
>> entry_id's that belong to BOTH cat_id 30 and 35.
>>
>> I tried "Select entry_id from myTable where cat_id = '30' and cat_id =
>> '35' but obviously that is incorrect.
>>
>> Can someone help? Thanks...
>>
>
> This isn't a PHP question - it's a database question. You need a group
> for your database (i.e. if it's MySQL, comp.databases.mysql).
>
> You'll get good answers there because that's where the SQL experts hang
> out. The answers posted here so far are incorrect.
>
That of course includes Jerry's.
I cant remember which paradox he is quiting..
Anyway the classic one is 'everything I say is false, Is this statement
true or false?
When dealing with Jerry, it is not a hypothetical question.
|