Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Team

I am using join to query record lists, results do populate on one record(Transaction Code only and need others like DateTime Passed. I cant amend my query to get more where clause on one query and need some help. Meaning is there a way in sql query where clause can be used to get more results? However my DateTime Passed record is not showing and need some help as well.

What I have tried:

select
     [Station Description]
     [Transaction Code]
 from [Tracking_Server_DB].[dbo].TS_Station as stn
 inner join [Tracking_Server_DB].[dbo].[Checkpoint Movement] as mv
     on stn.[Transaction Code]  = mv.[Transaction Code]
 where stn.[Station Description] IN ('T0011', 'M250', 'T0011')
 order by [DateTime Passed] desc
SQL

Posted
Updated 26-Aug-21 0:47am
v3
Comments
OriginalGriff 26-Aug-21 1:54am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Perhaps some sample input data and the outputs you get and expect would help us understand your problem better?

Use the "Improve question" widget to edit your question and provide better information.

1 solution

I'd strongly recommend to read this: Visual Representation of SQL Joins[^]

Quote:
However my DateTime Passed record is not showing and need some help as well.


If you would like to show another column, you have to add it to the list affter select statement.

SQL
USE [Tracking_Server_DB];

SELECT [Station Description], [Transaction Code], [DateTime Passed]
FROM TS_Station as stn INNER JOIN [Checkpoint Movement] as mv on stn.[Transaction Code]  = mv.[Transaction Code]
WHERE stn.[Station Description] IN ('T0011', 'M250', 'T0011')
ORDER BY [DateTime Passed] desc;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900