Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLSERVER Group by
Message
From
26/08/2019 07:16:27
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/08/2019 06:38:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01670317
Message ID:
01670318
Views:
75
This message has been marked as the solution to the initial question of the thread.
>Sir I have these codes
>
>
>SELECT conn.session_id,
>DB_NAME(database_id) as [DB],
>host_name,
>connect_time,
> net_transport
>	   FROM sys.dm_exec_sessions AS sess
>JOIN sys.dm_exec_connections AS conn
>   ON sess.session_id = conn.session_id
>   where DB_NAME(database_id)='at20'
>and net_transport='TCP'
>
>
>It shows data like shown in attachment 1
>
>https://imge.to/i/GBYtf
>
>But I need only this data shown in attachment 2
>
>https://ibb.co/M8trjpr
>
>I mean every unique host_name with min(connect_time)
>
>Please help
SELECT 
  min(conn.session_id) as session_id,
  DB_NAME(database_id) as [DB],
  [host_name],
  min(connect_time) as connect_time,
  net_transport
FROM sys.dm_exec_sessions AS sess
   JOIN sys.dm_exec_connections AS conn ON sess.session_id = conn.session_id
where DB_NAME(database_id)='at20' and net_transport='TCP'
group by [sess].[host_name], db_name(database_id), net_transport;
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform