如何使用where contdition选择值 [英] How to select value by using where contdition

查看:83
本文介绍了如何使用where contdition选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从表中选择数据

SELECT NM。[news_id],

NI.image_Path

,CONVERT(varchar(50) ,[news_date],106)as news_date

,NM。[news_head]

,NM。[short_news]

,NM。[news_descrip ]

,NM。[news_prod]

,NM。[prodduct_id]

,NM。[country]

,NM。[国家代码]

,NM。[news_url]

,NM。[news_source]

,NM。[news_status] < br $>
,NM.flag

,NM.Status

,NM。[RowNo]

,NM。[UpdatedON ],NM.ActionName FROM NewsMaster NM INNER JOIN news_images NI on NM。 news_id = NI.news_id

where --Created_Date = convert(varchar(10),getdate(),102)

Flag IS NULL

订购NM.news_date desc



我尝试过:



上面是我的查询我想知道如何给出条件

如果我的值为null标志列和状态列中的值为null然后我找到数据



但是当我的值在标志列中为null并且我的状态列中的值为5时,则找不到数据,所以请帮助如何在条件

i am selecting data from table
SELECT NM.[news_id],
NI.image_Path
,CONVERT(varchar(50), [news_date],106) as news_date
,NM.[news_head]
,NM.[short_news]
,NM.[news_descrip]
,NM.[news_prod]
,NM.[prodduct_id]
,NM.[country]
,NM.[countrycode]
,NM.[news_url]
,NM.[news_source]
,NM.[news_status]
,NM.flag
,NM.Status
,NM.[RowNo]
,NM.[UpdatedON],NM.ActionName FROM NewsMaster NM INNER JOIN news_images NI on NM. news_id = NI.news_id
where --Created_Date = convert(varchar(10), getdate(), 102)
Flag IS NULL
order by NM.news_date desc

What I have tried:

above is my query i want to know how to give condition
if my value is null flag column and value in status column null then i found data

but when my value is null in flag column and value is 5 in my status column then data not found so please help how to use condition in where condition

推荐答案

您的意思是

Do you mean
WHERE Flag IS NULL AND Status IS NULL





:doh:![/ edit]



[edit]:doh:![/edit]


这篇关于如何使用where contdition选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆