rows repeating

  • i am getting result like

    item1 item2 item3

    1 pen 34

    1 pen null

    how to remove the null one,i cannot place where is null

    any other way

  • hbtkp (4/10/2012)


    i am getting result like

    item1 item2 item3

    1 pen 34

    1 pen null

    how to remove the null one,i cannot place where is null

    any other way

    Again!!! :w00t:

    Your question(s) is/are so so vague!

    Please read the following article on the rules to be followed while posting!

    http://qa.sqlservercentral.com/articles/Best+Practices/61537/

  • ya again, my req r change ,plz help

  • hbtkp (4/10/2012)


    i am getting result like

    item1 item2 item3

    1 pen 34

    1 pen null

    how to remove the null one,i cannot place where is null

    any other way

    you are saying you cannot use a command like this, or you are not familiar with it?

    DELETE FROM UNKNOWNTABLENAME

    WHERE item1 = 1

    AND item2 = 'pen'

    AND item3 IS NULL

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (4/10/2012)


    hbtkp (4/10/2012)


    i am getting result like

    item1 item2 item3

    1 pen 34

    1 pen null

    how to remove the null one,i cannot place where is null

    any other way

    you are saying you cannot use a command like this, or you are not familiar with it?

    DELETE FROM UNKNOWNTABLENAME

    WHERE item1 = 1

    AND item2 = 'pen'

    AND item3 IS NULL

    of course the question then becomes why is he getting the null. is it the result of an outer join? if so then he would need to find the underlying table that is causing the null. really to little info to tell what is going on.

    to the OP please post DDL and Sample data along with the query you are running and you will get a much better answer.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • I agree with ColdCoffee on the vagueness of the questions.

    To the OP - you simple don't provide enough information to even begin answering your posts. Take a look at this article which will help explain.

    http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Works Perfectly for me with IS NULL.

    Tried it like this :

    Create Table Ex

    (item1 int,

    item2 varchar(5),

    item3 int)

    Insert Into Ex

    Select 1, 'pen', 34

    Union All

    Select 1, 'pen', null

    Select * From Ex

    Delete From Ex

    Where item3 IS NULL

    Select * From Ex

    and it worked perfectly.

    Please post your DDL and sample data, if you still think this doesn't work.

    Vinu Vijayan

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • vinu512 (4/12/2012)


    Works Perfectly for me with IS NULL.

    Tried it like this :

    Create Table Ex

    (item1 int,

    item2 varchar(5),

    item3 int)

    Insert Into Ex

    Select 1, 'pen', 34

    Union All

    Select 1, 'pen', null

    Select * From Ex

    Delete From Ex

    Where item3 IS NULL

    Select * From Ex

    and it worked perfectly.

    Please post your DDL and sample data, if you still think this doesn't work.

    Vinu Vijayan

    we can do that and lowell all ready posted that

    Lowell (4/10/2012)


    hbtkp (4/10/2012)


    i am getting result like

    item1 item2 item3

    1 pen 34

    1 pen null

    how to remove the null one,i cannot place where is null

    any other way

    you are saying you cannot use a command like this, or you are not familiar with it?

    DELETE FROM UNKNOWNTABLENAME

    WHERE item1 = 1

    AND item2 = 'pen'

    AND item3 IS NULL

    the question is vague and we are trying to get the op to answer why he wants to delete the nulls. if it is in a view or a join the query needs to be changed. if its in the table a delete statement is needed. there is just not enough information in the post.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply