开发者

How to put Flag on a column?

开发者 https://www.devze.com 2023-01-14 07:30 出处:网络
I am working on something where i have a table C with two columns Ndc and Price. All i care about the price field. it shows invalid values like 0, Null, negative. 开发者_StackOverflowthere is a left j

I am working on something where i have a table C with two columns Ndc and Price. All i care about the price field. it shows invalid values like 0, Null, negative. 开发者_StackOverflowthere is a left join between two tables A and B and i am getting table C from that. so Ndc values are matching and unmatching from both the tables but for that values it shows all invalid Price fields. How can i put flag on Ndc to show the unmatching Ndc Values?

Appreciate any help

Thanks


you could use a case statement like this

select case when isnull(price, 0) <= 0 then 0 else 1 end as validprice


It might help if you posted the SQL you have so far. It's possible that you might be able to accomplish this with an outer join and use the rows where the value is null.

0

精彩评论

暂无评论...
验证码 换一张
取 消