SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    since last visit...

    I have 2 tables; 'admin' & 'subscribers'. The admin table has a field named 'lastlogin' setup as datetime. The subscribers table has a field named 'dateadded' setup as date time. Both have id pk fields.

    All I'm trying to do is, when the admin logs in I want to show the number of new subscribers since last login.

    Should be simple, but I can't get it to work without errors.

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2005
    Location
    Venlo, the Netherlands
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all, you shouldn’t separate admin and subscribers in two tables. Both are people. Being an admin or subscriber is just a small extra feature. The rest of the information should be quite alike.

    But with two tables, a simple comparison may do:
    SELECT subscriber.name
    FROM subscriber, admin
    WHERE subscriber.dateadded > admin.lastlogin

    Make sure that ‘dateadded’ and ‘lastlogin’ are DATE or DATETIME fields

  3. #3
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your suggestion was the solution. Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •