Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Pasi
Posting Yak Master
166 Posts |
Posted - 2014-12-01 : 15:17:53
|
HI,I have a table called "alert" and in this table, for each columns there are data as 1 , or 0 or NULL. how do I write a query to just give me data's with "1" in them not the NULLS or 0?Thanks. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-12-01 : 15:27:39
|
select * from alert where somecolumn1 = 1 and somecolumn2 = 1 and somecolumn3 = 1 ...yada yada yadaNot sure if you want AND or OR for the query.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
Pasi
Posting Yak Master
166 Posts |
Posted - 2014-12-01 : 16:12:42
|
Thanks Tara. Ok, each columns like "Latex_allergy" may have 0 or 1 or Null for each person in the row in dB. I want to get only value of 1 for "latex_allergy" and so on for other columns for each person.Pasi |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-12-01 : 16:17:13
|
It's easiest to explain your problem when you show sample data and expected output. Otherwise, we are just going to go back and forth.I doubt this is what you want, but I don't have enough info:where latex_allergy = 1Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|