By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Sql Query problem

P: 109

I am learning MS SQL server. I have a query/store procedure to build.

I have a five numeric field and my query criteria is that find the data where the first field of those five numeric field should be null and then rest of them has some value in it.

for example,

field1 field2 field3 field4 field5
1 0 10 20 30
2 0 20 0 40 50
3 0 40 0 0 0
4 0 50 60 0 0

so, my query should give me the data of only row 1 and 2. Because 3 and 4 satisfy the first condition but its last ended up 0.

Any idea how I can do this in Ms sql 2000?

Thank You,
Feb 28 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,134
you need to write a where clause that
filters out the records you dont want

Expand|Select|Wrap|Line Numbers
  1. SELECT fieldlist
  2. FROM TableName
  3. WHERE thisField=this and thisField=this etc
something like that
you need to construct this bit
WHERE thisField=this and thisField=this etc
so that it returns the records you want
Feb 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.