Forum Replies Created

Viewing 15 posts - 46 through 60 (of 103 total)

  • RE: Help with Counts

    stephen99999 (1/12/2012)


    Mark-101232 (1/12/2012)


    bicky1980 (1/12/2012)


    stephen99999 (1/12/2012)


    in table format, bicky, please post what you are expecting your results to look like. Earlier you stated you wanted to see 9, 6, etc to...

  • RE: Help with Counts

    stephen99999 (1/12/2012)


    in table format, bicky, please post what you are expecting your results to look like. Earlier you stated you wanted to see 9, 6, etc to be returned, and...

  • RE: Help with Counts

    stephen99999 (1/11/2012)


    @bicky

    It has to be one of these two options lol. For each option, I started out with a quote on your desired results should be, as well as...

  • RE: Help with Counts

    Hello All

    I think I have managed to run the counts individually

    select count(*) from test

    select count(distinct datakey) as Unique_Dataset

    from (select *, row_number() over(partition by datakey order by case when Datakey!='' then...

  • RE: Help with Counts

    No, its not performing the counts I need to get back (thanks for the effort though)

    Total = 9

    Total Unqiue Datakey = 6

    Total Unique Landline = 6

    Total Unique Mobile =5

    Total Unique...

  • RE: Help with Counts

    The query certainly groups the results by the datakey

    but all the values are the same...

  • RE: Help with Counts

    stephen99999 (1/11/2012)


    bicky1980 (1/11/2012)


    stephen99999 (1/11/2012)


    Try this bick, and please reply with the results... I am not on a machine with management studio, so can't test.

    SELECT datakey,COUNT(datakey) OVER(Partition by datakey) AS Uniquedatakey,

    ...

  • RE: Help with Counts

    stephen99999 (1/11/2012)


    Try this bick, and please reply with the results... I am not on a machine with management studio, so can't test.

    SELECT datakey,COUNT(datakey) OVER(Partition by datakey) AS Uniquedatakey,

    ...

  • RE: Help with Counts

    stephen99999 (1/11/2012)


    Have not tested this, but :

    SELECT COUNT(DISTINCT datakey) OVER(Partition by datakey) AS Uniquedatakey,

    COUNT(DISTINCT CASE WHEN landline<>'' THEN landline END) OVER(Partition by datakey)...

  • RE: Help with Counts

    Cadavre (1/11/2012)


    I can't quite match your requested results, can you double check them?

    I make it: -

    Total ...

  • RE: Help with Counts

    Mark-101232 (1/11/2012)


    worker bee (1/11/2012)


    I know your not inserting columns, :), After you insert you data into the table you are wanting to count the datakey column, if so then your...

  • RE: Help with Counts

    worker bee (1/11/2012)


    Try this to start, I found this on another web site. I googled count figures in sql table.

    http://www.w3schools.com/sql/sql_func_round.asp

    SELECT DataKey, ROUND(DataKey,0) as DataKey FROM Tablename

    I feel you...

  • RE: Help with Counts

    worker bee (1/11/2012)


    I know your not inserting columns, :), After you insert you data into the table you are wanting to count the datakey column, if so then your select...

  • RE: Help with Counts

    worker bee (1/11/2012)


    I am a little confused, are you inserting records then wanting to do a count on the table on certain columns?

    I am not inserting columns (just did that...

  • RE: SQL Alerts

    Hi

    I personally put the code into job

    E.g.

    DECLARE @totalrecords int,

    @lcmessage nvarchar(max)

    select @totalrecords=count(*) from [tablename]

    set @lcmessage=

    'This is a Test

    Your query has completed and there are '+CAST(@totalemails AS NVARCHAR)+' new records'

    EXECUTE Msdb..sp_send_dbmail...

Viewing 15 posts - 46 through 60 (of 103 total)