Query Help - Selecting rows that have data in column

Discussion in 'Databases' started by Jakobi, May 5, 2007.

  1. #1
    Hello,

    How do I query the rows that have data in a certain column only?

    I have 5 columns

    ID, Files, Daily, Monthly, Yearly

    I want to only query the rows that have data in column Monthly.
    
    SELECT * FROM `files` ORDER BY `files` DESC LIMIT 9"
    Code (markup):
    This shows me all of them but I want only whens that have a data in column monthly. I am not sure of the proper syntax to do so.

    Any insight would be great.
     
    Jakobi, May 5, 2007 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    SELECT * FROM `files` WHERE Monthly IS NOT NULL ORDER BY `files` DESC LIMIT 9
    Code (markup):
    or

    SELECT * FROM `files` WHERE Monthly <> '' ORDER BY `files` DESC LIMIT 9
    Code (markup):
     
    SoKickIt, May 5, 2007 IP
  3. Jakobi

    Jakobi Active Member

    Messages:
    291
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Thank you.
     
    Jakobi, May 5, 2007 IP