|
-
May 31st, 2007, 09:25 PM
#1
[Resolved - with issues]TableAdapter SQL DISTINCT Year
Hi Guys,
Prior to VB.Net 2005, I could return distinct years from a DateTime field by prefixing the field in the SQL statement with the Year() function (Eg: "SELECT DISTINCT Year[Log_Date] FROM tbl_Logbook GROUP BY Year[Log_Date]").
However, I cannot figure out how to do it with a DataTable/TableAdapter SQL in 2005 with the following SQL statement as 'Year' is an unrecognised function.
SELECT DISTINCT Year[Log_Date] FROM tbl_Logbook GROUP BY Year[Log_Date]
I have used the TableAdapter Configuration Wizard to no avail.
What I need is unique, distinct years from a DB.
Eg.
Log_Date column may have the following values: 23/5/2001, 28/6/2001, 2/9/2004
I need to return all records (grouped) by year, ie: 2001 and 2004.
Ideas?
Last edited by Bruce Fox; May 31st, 2007 at 11:11 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|