Getting login and logoff count

  • Hi all,

    I am having a table in which an entry is made when the user logs in to the application and the 'logoffdate' will be null.

    When the user logs off properly, then the logoff date will be filled.

    Now I want to get a result as follows:

    The user name, total login and total improper logoff

    I used group by and retrieved the total logins but I don't know how to get the log off in the single select statement.

    Can any one help in this regard?

    Thanks a lot in advance.

    [font="Arial"]Nothing is impossible with Hard Work[/font]:)

  • Hi,

    Why don't you try this:

    Select user_name, count(All login), count(All login) - count(All logoff)

    From table_name

    group by user_name

    All is default anyway, just to make sure it will not count null values.

    hope this helps.

    Vijay.

    Warm Regards,
    Neel aka Vijay.

  • Dear Neelakandan,

    Thanks a lot.

    I have solved the issue by using the case in the select query.

    [font="Arial"]Nothing is impossible with Hard Work[/font]:)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply