WHERE Command Usage?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 6, 2009   (RSS)

I'm losing my mind here, but could you tell me what the usage for the WHERE command is to get it to display two records from the same table. I need to pull records that match the key words "Global" and "Alley". I've used the following variations with no luck.

'where' => 'department = "Alley" AND "Global"',

'where' => 'department = "Alley" AND
'department = "Global"',

'where => 'department = "Alley" && "Global"',

What is the correct format and is there any notes on the SQL format that you guys are using.

Re: [movierelics] WHERE Command Usage?

Also, when I use,

'where' => 'department = "Alley"' AND 'department = "Global"',

It displays articles tagged with other departments and not just the ones tagged "Alley" and "Global".

Re: [movierelics] WHERE Command Usage?

By Dave - February 5, 2009

Hi movierelics,

Is it a single value field or a multi value field? (eg: Is it a list field that lets you select multiple values at the same time?)
Dave Edis - Senior Developer
interactivetools.com

Re: [movierelics] WHERE Command Usage?

By Dave - February 6, 2009

Try this:

'where' => " department = 'Alley' OR department = 'Global' ",

And if you're using a multi value list field and the above doesn't work try this:

'where' => " department LIKE '%Alley%' OR department LIKE '%Global%' ",

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com