---
title: "problem in check the null condition in query"  
description: "problem in check the null condition in query"  
author: "Anonymous User"  
published: 2011-01-14  
updated: 2011-01-17  
canonical: https://www.mindstick.com/forum/151/problem-in-check-the-null-condition-in-query  
category: "cold fusion"  
tags: ["cold fusion"]  
reading_time: 1 minute  

---

# problem in check the null condition in query

This is the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)\
\

```
SELECT query1.field1, query1.field2, query1.field3
FROM query1
WHERE field1 not in (#QuotedValueList(query2.field1)#)
```

\
I need to change that "WHERE" line to make this [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver) run even if query2 is\
null. It currently doesn't work if query2 is null.\
\
how it is solve it give the solution of its ![problem in check the null condition in query](https://www.mindstick.com/app_images/htmleditor.icons/msp_cursing.gif)\

## Replies

### Reply by Anonymous User

check the null condition in query2 field we apply the if condition and check the record count of that field\
\

```
SELECT query1.field1, query1.field2, query1.field3FROM query1<CFIF query2.RecordCount IS NOT 0>WHERE field1 not in (#QuotedValueList(query2.field1)#)</CFIF>
```


---

Original Source: https://www.mindstick.com/forum/151/problem-in-check-the-null-condition-in-query

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
