Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLSERVER Group by
Message
De
26/08/2019 07:16:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
26/08/2019 06:38:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01670317
Message ID:
01670318
Vues:
74
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform