1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

which sql query time do you prefer?

Discussion in 'XenForo Development Discussions' started by maidos, Oct 15, 2010.

  1. maidos

    maidos Active Member

    new at sql so need your opnions which query you prefer for selecting months? these two are meant to do same thing

    SELECT ftgnamn,​
    FROM ansokan​
    WHERE MONTH(intervjutidpunkt) = 11​
    OR intervjutidpunkt IS NULL​


    select ftgnamn, erbjnamn, sokarnr, intervjutidpunkt, loneansprak​
    from ansokan​
    where intervjutidpunkt between '2010-11-01' and '2010-11-30' or intervjutidpunkt is null​
    order by intervjutidpunkt​
  2. Mike

    Mike XenForo Developer Staff Member

    The second one should allow an index to be used, if there is one that's applicable.
    maidos likes this.

Share This Page