What is the correct syntax for where the results may be 1 or 2? What
have I done wrong?
SELECT * FROM table WHERE name LIKE "ABC" AND listing_type = 1 or 2
???
Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I like the "IN" keyword:
SELECT * FROM table WHERE name LIKE "ABC" AND listing_type IN ('1','2');
works kinda like PHP's "in_array"
-- matt
On Sun, Mar 9, 2008 at 1:34 PM, Ron Piggott <[EMAIL PROTECTED]>
wrote:
> What is the correct syntax for where the results may be 1 or 2? What
> have I
I am wondering what is wrong with this syntax?
SELECT * FROM ministry_directory INNER JOIN
ministry_directory_listing_categories ON ministry_directory.entry =
ministry_directory_listing_categories.ministry_directory_entry WHERE
ministry_directory.listing_type = 2 AND
ministry_directory_listing_c
ministry_directory_listing_categories.ministry_directory_category_reference =
10 AND
>
ministry_directory_listing_categories.ministry_directory_category_reference
= 11
Can a record really have a reference for two different id's like this?
ie can it be both '10' and '11' at the same time?
Two different rows Chris.
reference ministry_directory_entry ministry_directory_category_reference
13 1 10
14 1 11
What I am trying to do is allow the user to make a more specific search.
Ron
On Mon, 2008-03-10 at 10:37 +1100, Chris wrote:
>
> > ministry_directory_list
Ron Piggott wrote:
Two different rows Chris.
That's the problem then.
Your query is saying "get records with category_reference of 10 and it
has to have category_reference of 11 as well".
No such rows exist.
Maybe that should be an 'or' or 'in' (same thing).
...
ministry_directory_listi
I think what you mean to do is use IN(). And I would suggest table aliases.
So it could look like this:
SELECT * FROM ministry_directory md INNER JOIN
ministry_directory_listing_categories mdlc ON md.entry =
mdlc.ministry_directory_entry
WHERE md.listing_type = 2
AND mdlc.ministry_directory_
Thanks
On Mon, 2008-03-10 at 12:56 +1300, Bruce Cowin wrote:
> I think what you mean to do is use IN(). And I would suggest table aliases.
> So it could look like this:
>
> SELECT * FROM ministry_directory md INNER JOIN
> ministry_directory_listing_categories mdlc ON md.entry =
> mdlc.minist