Forum Replies Created

Viewing 15 posts - 1 through 15 (of 26 total)

  • RE: Count day pr mont, year

    Hi Again Aaron!

    I have some problems with this query. Will you still help me?

    In the test db i...

  • RE: overlap booking problem

    if i understand you correct.

    SET dateformat dmy

    Declare @starttime datetime

    Declare @stoptime datetime

    Set @starttime = '11.10.2004 08:00:00'

    Set @stoptime = '11.10.2004 17:59:59'

    SELECT * FROM <your table> WHERE start between @starttime and @stoptime AND finish between @starttime and @stoptime

    Morten

  • RE: Count day pr mont, year

    Very close now. The count of days and cars are extremly high. It is about over 2000 active cars every mont and that isent...

  • RE: Count day pr mont, year

    Sorry that im no better than this.

    Server: Msg 207, Level 16, State 3, Line 41

    Invalid column name 'GjelderFra'.

  • RE: Count day pr mont, year

    Sorry!

    Server: Msg 107, Level 16, State 2, Line 16

    The column prefix 'AN' does not match with a table name or alias name used in the query.

    Server: Msg 107, Level 16,...

  • RE: Count day pr mont, year

    Hi again!

    error:

    Server: Msg 170, Level 15, State 1, Line 22

    Line 22: Incorrect syntax near ','.

    its her -->                            , AN.ANAvn

    The code look like this now:

    -- Get a listing of...

  • RE: Count day pr mont, year

    Hi Aron!

    i have created the table.

    Where shall i put this code?

    INSERT INTO #Months

                 SELECT MonthsTable.TheMonth AS MonthGroup,

                            case when DATEPART( month, GjelderFra ) = 1 then 'Januar'

                                        when DATEPART( month,...

  • RE: Count day pr mont, year

    It is the where statement who go against the "dato" field that generates the date with cars, but i cant see to solve the problem. It is this i must change....

  • RE: Count day pr mont, year

    I dont get the message if i remove --ALTER TABLE #Months

  • RE: Count day pr mont, year

    Thanks!

    Server: Msg 156, Level 15, State 1, Line 36

    Incorrect syntax near the keyword 'Create'.

    Create table #DataRows ( RowLabel varchar(100), BID int

                , Regnr varchar(7), ANavn varchar(50), GjelderFra datetime

                , SiOppForsikringFra...

  • RE: Count day pr mont, year

    The posts when i run...

                SELECT COUNT (DISTINCT GjelderFra)

                       FROM marsh_HKL.tblhertzkorttidsleiebiler

                            LEFT JOIN marsh_HKL.tblhertzkorttidsleieAvdeling

                                   ON FKBRAvdeling=AID

    THIS IS 383

                SELECT COUNT (DISTINCT GjelderFra)

                       FROM marsh_HKL.tblhertzkorttidsleiebiler, marsh_HKL.tblhertzkorttidsleieAvdeling

                       WHERE FKBRAvdeling=AID

    THIS IS...

  • RE: Count day pr mont, year

    An new error become:

    Server: Msg 156, Level 15, State 1, Line 36

    Incorrect syntax near the keyword 'Create'.

    Server: Msg 156, Level 15, State 1, Line 62

    Incorrect syntax near the keyword 'ON'.

    Morten

  • RE: Count day pr mont, year

    I dont get the error if i change

                SELECT DISTINCT GjelderFra FROM marsh_HKL.tblhertzkorttidsleiebiler

                            LEFT JOIN marsh_HKL.tblhertzkorttidsleieAvdeling

                                   ON FKBRAvdeling=AID --AND GjelderFra between @datoFOM and @datoTOM

    to

                FROM marsh_HKL.tblhertzkorttidsleiebiler

                            LEFT JOIN marsh_HKL.tblhertzkorttidsleieAvdeling...

  • RE: Count day pr mont, year

    Hi!

    I run this i query an...

    -- Get a listing of every month to be summarized

    if(object_id('tempdb.dbo.#Months')<>1)

     drop table #Months

    if(object_id('tempdb.dbo.#DataRows')<>1)

     drop table #DataRows

    Create table #Months ( MonthGroup smalldatetime, MonthName varchar(25), ANAvn varchar(50)  )

    INSERT INTO...

  • RE: Count day pr mont, year

    The error now is

    Server: Msg 207, Level 16, State 1, Line 16

    Invalid column name 'GjelderFra'.

    Server: Msg 207, Level 16, State 1, Line 16

    Invalid column name 'ANAvn'.

Viewing 15 posts - 1 through 15 (of 26 total)