Sql Query problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arial
    New Member
    • Sep 2007
    • 109

    Sql Query problem

    Hi,

    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,
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    you need to write a where clause that
    filters out the records you dont want

    ie
    Code:
    SELECT fieldlist
    FROM TableName
    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

    Comment

    Working...