I want to select multiple records on the basis of a matching year, for example in table tab
where columns are [id] int
, [name] varchar
, [bookyear] datetime
I want to select all records where the year is 2009.
The following query gives 0 results:
SELECT [ACCNO]
,[Roll No]
,[IssueDate]
,[DueDate]
FROM [test1].[dbo].[IssueHis$]
where [IssueDate] between 12-12-2004 and 1-01-2010
select id,name,bookyear from tab1 where year(bookyear) = 2009
SELECT [ACCNO]
,[Roll No]
,[IssueDate]
,[DueDate]
FROM [test1].[dbo].[IssueHis$]
WHERE [IssueDate] >= '20090101' AND
[IssueDate] < '20100101'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With