PDA

View Full Version : Can't select null value



yoyali
07-05-2006, 01:36 PM
Hello everybody,
I'm having this problem, i'm trying to select the users in my db which are not in any of the groups so their group id will be null. But when i write the sql statment it returns nothing althought there are so many users with no group.
this my sql statment

<select name="attachuser" size="1" >
<option value="" >Select User</option>
<%
sql="select * from users where group_id=null "
set rs=conn.Execute(sql)
while not rs.eof
%>
<option value="<%=rs("user_id")%>" ><%=rs("user_name")%>
</option>
<%
rs.movenext
wend
%>
</select>
I'm using sql server 2000,
Thank u very much
Yoya

IanG
07-18-2006, 05:22 PM
Hi,
Hopefully you found your answer in a SQL guide.

Try
sql="select * from users where group_id is null "

Ian