Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

SQL query: existing values in column

Discussion in 'Information Technology' started by Anakin Moonwalker, Nov 17, 2005.

  1. Anakin Moonwalker

    Anakin Moonwalker
    Expand Collapse
    Guest

    I have a table with 2 columns.

    ColumnA ColumnB
    apple fruit
    ball
    cat animal
    dog animal
    egg
    fox animal

    What should be my SQL query, if the output that I want are only the rows
    with existing values in ColumnB, like this:

    ColumnA ColumnB
    apple fruit
    cat animal
    dog animal
    fox animal
     
  2. Loading...

    Similar Threads Forum Date
    Microsoft Brings 64-Bit Perks in SQL Server 2000 Service Pack (Ziff Davis) Interfaith Dialogues May 7, 2005
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006

  3. Ofer

    Ofer
    Expand Collapse
    Guest

    Try this

    Select columnA,columnB From TableName Where columnB Is not Null And ColumnB
    <> ""

    --
    I hope that helped
    Good Luck


    "Anakin Moonwalker" wrote:

    > I have a table with 2 columns.
    >
    > ColumnA ColumnB
    > apple fruit
    > ball
    > cat animal
    > dog animal
    > egg
    > fox animal
    >
    > What should be my SQL query, if the output that I want are only the rows
    > with existing values in ColumnB, like this:
    >
    > ColumnA ColumnB
    > apple fruit
    > cat animal
    > dog animal
    > fox animal
    >
    >
    >
     
  4. Simple Simon SQL Diamond

    Simple Simon SQL Diamond
    Expand Collapse
    Guest

    in design veiw of the quiry in columnB Criteria type: is not null then all
    those ColumnA entries without columnB will not be shown.

    Cheers

    "Anakin Moonwalker" wrote:

    > I have a table with 2 columns.
    >
    > ColumnA ColumnB
    > apple fruit
    > ball
    > cat animal
    > dog animal
    > egg
    > fox animal
    >
    > What should be my SQL query, if the output that I want are only the rows
    > with existing values in ColumnB, like this:
    >
    > ColumnA ColumnB
    > apple fruit
    > cat animal
    > dog animal
    > fox animal
    >
    >
    >
     
  5. Anakin Moonwalker

    Anakin Moonwalker
    Expand Collapse
    Guest

    Thanks. It worked!

    "Ofer" wrote:

    > Try this
    >
    > Select columnA,columnB From TableName Where columnB Is not Null And ColumnB
    > <> ""
    >
    > --
    > I hope that helped
    > Good Luck
    >
    >
    > "Anakin Moonwalker" wrote:
    >
    > > I have a table with 2 columns.
    > >
    > > ColumnA ColumnB
    > > apple fruit
    > > ball
    > > cat animal
    > > dog animal
    > > egg
    > > fox animal
    > >
    > > What should be my SQL query, if the output that I want are only the rows
    > > with existing values in ColumnB, like this:
    > >
    > > ColumnA ColumnB
    > > apple fruit
    > > cat animal
    > > dog animal
    > > fox animal
    > >
    > >
    > >
     

Share This Page