Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 472.9k

How to use count in your query

May 11 2021 9:02 PM
Hi Team
 
I am struggling to get number of times, unit passed(Date-Passed column from Checkpoint-Movement table), PNR(column from Checkpoint-Movement table), Station Description(column from Station table). Given to the below tables; I want to filter between 06:00am-20:00pm today
  1. /****** Script for SelectTopNRows command from SSMS  ******/  
  2. SELECT TOP 1000 [Station Code]  
  3.       ,[Machine Name]  
  4.       ,[Station Description]  
  5.       ,[IP Address]  
  6.       ,[Tracking Client Name]  
  7.       ,[Previous Station Code]  
  8.       ,[Next Station Code]  
  9.       ,[Transaction Code]  
  10.       ,[SQL_Instance]  
  11.       ,[rowguid]  
  12.   FROM [Tracking_Server_DB].[dbo].[TS_Station]  
  13.   
  14. SELECT TOP 1000 [Plant Code]  
  15.       ,[Production Year]  
  16.       ,[PNR]  
  17.       ,[KNR]  
  18.       ,[Colour]  
  19.       ,[Model Code]  
  20.       ,[Market]  
  21.       ,[Country]  
  22.       ,[Transaction Code]  
  23.       ,[DateTime Passed]  
  24.       ,[Telegram]  
  25.       ,[Hold Get]  
  26.       ,[Option Code 1]  
  27.       ,[EQS Carstate]  
  28.       ,[SeqNum]  
  29.       ,[RBSCode]  
  30.       ,[Return_CP_Name]  
  31.   FROM [Tracking_Server_DB].[dbo].[Checkpoint Movement]  

Answers (6)