Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to convert First Function from MS Acess to T-SQL

Avatar of sqlman08
sqlman08 asked on
Microsoft AccessMicrosoft SQL Server
18 Comments1 Solution294 ViewsLast Modified:
Hi,
I have the following query from MS Access Database how do I convert this into Sql Server 2005, as it does not use the First Function.

SELECT
      TableA.OrderRef,
      First(TableA.AssetTag) AS FirstOfAssetTag,
      First(TableA.SerialTag) AS FirstOfSerialTag,
      TableA.CategoryId,
      TableA.Type,
      TableA.Description

FROM
      TableA
GROUP BY
      TableA.OrderRef,
      TableA.CategoryId,
      TableA.Type,
      TableA.Description
HAVING
      (((First(TableA.AssetTag))>"1")
      AND ((First(TableA.SerialTag)) Is Not Null)
      AND ((TableA.CategoryId)<>"Monitor"
      And (TableA.CategoryId)<>"BO")
      AND ((TableA.Type)="y" Or (TableA.Type)="e" Or (TableA.Type)="p"))
ORDER BY
      TableA.OrderRef


Thanks