Active Record
ExpressionEngine 2
Back to this add-on's main page
View Other Add-ons From Rob Sanchez
Where !=
General
bsrweb
|
Posted: 17 February 2011 07:14 PM |
|
|
|
Hi, I must be missing something very obvious to everyone else but I can’t figure out how to correctly display results in a column if it’s not blank. My query:
{exp:activerecord
select = “m_field_id_2”
from = “member_data”
sort = “asc”
distinct = “yes”
where:m_field_id_2 != ” “
limit = “10”
}
{count}: {m_field_id_2}
{/exp:activerecord}
CI Activerecord uses “!=” for NOT in the WHERE clause but this doesn’t seem to work. What am I doing wrong?
|
|
|
Rob Sanchez
|
Posted: 18 February 2011 04:08 AM |
# 1
|
|
Developer
|
This syntax won’t work because of the way EE parses out tag parameters. I’ll need to think of an alternate syntax for this scenario.
|
|
|
bsrweb
|
Posted: 18 February 2011 05:32 PM |
# 2
|
|
|
Thanks for your response! I’ll use good ole exp:query for this situation then.
|
|
|
Rob Sanchez
|
Posted: 19 February 2011 07:17 PM |
# 3
|
|
Developer
|
You could write out the where statement yourself:
{exp:activerecord select = m_field_id_2 from = member_data sort = asc distinct = yes where = mfield_id_2 != '' limit = 10 } {count}: {m_field_id_2} {/exp:activerecord}
|
|
|
Rob Sanchez
|
Posted: 29 June 2011 10:10 PM |
# 4
|
|
Developer
|
FYI, there’s now support for != and other alternate comparison operators in where statements
where:field[!=]="something"
|
|
|