Hi makumbi,
Refer below sample query.
SQL
CREATE TABLE StudentBilling(
[Account] [NVARCHAR](50) NULL,
[Names] [VARCHAR](50) NULL,
[Term] [VARCHAR](50) NULL,
[Sessiond] [VARCHAR](50) NULL,
[Dates] [VARCHAR](50) NULL
)
INSERT INTO StudentBilling VALUES('05-00002','MAKUMBI SULAIMAN','TERM1','Both','00:00.0')
CREATE PROCEDURE [CheckMinimumdate]
@k NVARCHAR(50)
AS
Begin
SELECT account,Names,Term,Sessiond,Dates FROM StudentBilling
WHERE Dates = (SELECT max(Dates) FROM StudentBilling) and account=@k
END
EXEC CheckMinimumdate '05-00002'
Output
Account |
Names |
Term |
Sessiond |
Dates |
05-00002 |
MAKUMBI SULAIMAN |
TERM1 |
Both |
00:00.0 |