Skip to main content
Participating Frequently
August 9, 2008
Question

Simple Query Problem

  • August 9, 2008
  • 2 replies
  • 290 views
Happy Saturday, Y'all.

I'm trying to run a simple query that pulls neighborhood members without a last name, using:

<cfquery name="members" datasource=stevenson>
SELECT *
FROM memberdirectory
WHERE lastname neq ""
order by lastname asc
</cfquery>

but, the WHERE line always trips it up.
What would be the correct coding for that query there ?

Thanks in advance..
This topic has been closed for replies.

2 replies

Inspiring
August 9, 2008
depending on how you are storing your data, it could be,

where lastname is null.
Inspiring
August 9, 2008
This would be if there is no last name:

<cfquery name="members" datasource=stevenson>
SELECT *
FROM memberdirectory
WHERE lastname = ""
order by lastname asc
</cfquery>

This would be if there is a last name:

<cfquery name="members" datasource=stevenson>
SELECT *
FROM memberdirectory
WHERE lastname <> ""
order by lastname asc
</cfquery>


--
Ken Ford
Adobe Community Expert Dreamweaver/ColdFusion
Fordwebs, LLC
http://www.fordwebs.com


"keller18" <webforumsuser@macromedia.com> wrote in message
news:g7k70p$h5l$1@forums.macromedia.com...
> Happy Saturday, Y'all.
>
> I'm trying to run a simple query that pulls neighborhood members without a
> last name, using:
>
> <cfquery name="members" datasource=stevenson>
> SELECT *
> FROM memberdirectory
> WHERE lastname neq ""
> order by lastname asc
> </cfquery>
>
> but, the WHERE line always trips it up.
> What would be the correct coding for that query there ?
>
> Thanks in advance..
>