Query to show only IS NOT NULL

When I create the query in Access, in the design mode, I am using IS NOT NULL in the criteria area. However, it isn't working at all. I am still getting everything.
SELECT UI_ISH_PROD_DB_sales_contact.cust_acct_nbr, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_area_cd, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_nbr
FROM UI_ISH_PROD_DB_sales_contact
GROUP BY UI_ISH_PROD_DB_sales_contact.cust_acct_nbr, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_area_cd, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_nbr
HAVING (((UI_ISH_PROD_DB_sales_contact.prim_bus_ph_nbr) Is Not Null));

Open in new window

ba_trainerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
Try this


SELECT UI_ISH_PROD_DB_sales_contact.cust_acct_nbr, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_area_cd, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_nbr
FROM UI_ISH_PROD_DB_sales_contact
GROUP BY UI_ISH_PROD_DB_sales_contact.cust_acct_nbr, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_area_cd, UI_ISH_PROD_DB_sales_contact.prim_bus_ph_nbr
HAVING IFNULL(UI_ISH_PROD_DB_sales_contact.prim_bus_ph_nbr, '') <> '';
0
peter57rCommented:
SELECT A.cust_acct_nbr, A.prim_bus_ph_area_cd, A.prim_bus_ph_nbr
FROM UI_ISH_PROD_DB_sales_contact as A
where A.prim_bus_ph_nbr Is Not Null
GROUP BY A.cust_acct_nbr, A.prim_bus_ph_area_cd, A.prim_bus_ph_nbr
0
ba_trainerAuthor Commented:
asvforce: - I get an error message regarding IFNULL

peter57r: - It doesn't change anything except for the table name.
0
peter57rCommented:
Then you don't really have any nulls in your data.  The fields must contain something -  spaces probably.
I suggest you run this query to see if you have any nulls...

SELECT A.cust_acct_nbr, A.prim_bus_ph_area_cd, A.prim_bus_ph_nbr
FROM UI_ISH_PROD_DB_sales_contact as A
where A.prim_bus_ph_nbr Is Null
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.