Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7735323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:28:24+00:00 2026-06-01T07:28:24+00:00

Table1: ResourceID Name0 (STRING) NumberOfLongons0 (INT) LastLogon0 (DateTIME) Table2: ResourceID NetbiosName0 I am trying

  • 0

Table1:

ResourceID
Name0 (STRING)
NumberOfLongons0 (INT)
LastLogon0 (DateTIME)

Table2:

ResourceID
NetbiosName0

I am trying to retrieve the following data:

NetbiosName0, Name0, NumberOfLogons0, LastLogon0 where it shows me NetbiosName0, regardless if the other data is present AND the Name0/LastLogon0 where NumberOfLogons0 is the HIGHEST for the ResourceID

UPDATE:

Tested the SQL:

SELECT T2.ResourceID, T2.Netbios_Name0, T1.Name0, T1.NumberOfLogons0, t1.LastLogon0 
FROM V_R_System T2 LEFT OUTER JOIN v_GS_NETWORK_LOGIN_PROFILE T1 
ON T2.ResourceID = T1.ResourceID 
WHERE NOT EXISTS 
(SELECT * FROM v_GS_NETWORK_LOGIN_PROFILE 
    WHERE ResourceID = T2.ResourceID AND NumberOfLogons0 > T1.NumberOfLogons0)

and got the following results:

8435 CLETESTXP-001 NT AUTHORITY\LOCAL SERVICE 
8435 CLETESTXP-001 NT AUTHORITY\NETWORK SERVICE 
8435 CLETESTXP-001 NT AUTHORITY\SYSTEM 
8435 CLETESTXP-001 TESTAGNA\JBradnan 109 3/22/2012 11:37:00 AM
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:28:27+00:00Added an answer on June 1, 2026 at 7:28 am

    In SQL Server 2008 or later, you can do this:

    select
      R.ResourceID,
      R.NetbiosName0,
      L.Name0,
      L.LastLogon0
    from Table2 as R
    outer apply (
      select top (1) 
      -- add WITH TIES
      -- if the largest NumberOfLogons0 value can occur multiple times
        Name0,
        LastLogon0
      from Table1 as L
      where L.ResourceID = R.ResourceID
      order by NumberOfLogons0 desc
    ) as L
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following code snippet to read data from the database :
I am trying to connect Hibernate(3.2.5) with PostgreSQL 8.2., but I am getting following
Given the following tables: Resources: ID int, Name varchar(100), Address varchar(500), City varchar(100), etc.
I have the following set of tables in an existing database. Resource - ResourceID
Is there a way to export table data to a MIME Resource (Flex3 component)
Table1: Everything including the kitchen sink. Dates in the wrong format (year last so
Table1 Time 10:00:00 12:00:00 Absent 14:00:00 Holiday ..., Time column Datatype is varchar I
Table1 ID product 001 LG 001 Sony 001 LG 001 LG 001 Sony 001
Table1 ID | WorkTime ----------------- 001 | 10:50:00 001 | 00:00:00 002 | ....
Table1 Date id salary 01/2012 001 1500 01/2011 001 750 01/2010 001 500 from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.