Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)

  • RE: Count days per month per year between 2 dates

    Luis Cazares (3/14/2014)


    Actually, you don't have to create and drop the calendar table. Calendar tables are meant to make date calculations easier and should be permanent tables. With the proper...

  • RE: Count days per month per year between 2 dates

    Eugene Elutin (3/11/2014)


    or without calendar table:

    declare @dtFrom date

    declare @dtTo date

    select @dtFrom = '2013-12-15'

    ,@dtTo = '2014-02-18'

    select year(dt) [Year], month(dt) [Month], count(*)

    from...

  • RE: Filter suppliers that dindn't sell

    Solved like this:

    SELECT

    fc.no, fc.nome,

    'FANO1' = SUM(Case When year(datalc)=2010 Then fc.ecred Else 0 End),

    'Dif' = SUM(Case When year(datalc)=2010 Then fc.ecred Else 0 End)-SUM(Case When year(datalc)=2009 Then fc.ecred Else 0 End)

    FROM

    fc(nolock) left...

  • RE: Select with 2 different conditions

    That helped alot, but i don't quite have what i need. I forgot to mention, i do have other two columns which are relevant, so i made it like this:

    WITH...

  • RE: Select with 2 different conditions

    No, none at all.

    I mean, they actually are the same columns repeated, but as the data will be different (cause of different conditions) i intend to name them differently.

Viewing 5 posts - 1 through 5 (of 5 total)