We previously had an Access database performing operations. We are now converting it over to SQL. There are queries in Access that use the "First" function to insert data, which I have not been able to find the equivalent to in SQL. Below is an example showing the data used, the SQL syntax and the results that it would produce.
tbl_Data FirstN LastN CustNum TDate SalesPer Jim Smith 11111 5/10/2014 Jim Johnson Sally Jones 22222 5/12/2014 Alan Brown Sally Jones 22222 5/10/2014 Ben Doers Jim Smith 11111 5/12/2014 Jim Johnson Frank Oliver 33333 5/15/2014 Jim Johnson Results to be inserted into tbl_Main FName LName CustID TransDate SalesPerson Jim Smith 11111 5/10/2014 Jim Johnson Sally Jones 22222 5/10/2014 Ben Doers Frank Oliver 33333 5/15/2014 Jim Johnson Below is the SQL that will produce this INSERT INTO tbl_Main ( FName, LName, CustID, TransDate, SalesPerson) SELECT td.FirstN, td.LastN, td.CustNum, First(td.TDate) As SellDate, First(td.SalesPer) As SP FROM tbl_Data td GROUP BY td.FirstN, td.LastN, td.Cust;If anyone could assist me in an alternative that I could use in SQL to yield the same results, I'd appreciate it.