Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL query errors

Status
Not open for further replies.

btaber

Programmer
Joined
May 26, 2002
Messages
307
Location
US
I am converting my program from a ms access backend to a ms sql server backedn (msde) and a buch of queries are not working. This is the query:

SELECT FIRST(DelLoc.Loc) AS Loc, FIRST(DelLoc.Des) AS Des, Count(*) AS TotItems FROM (AddItems INNER JOIN SM ON AddItems.Man = SM.ID) INNER JOIN DelLoc ON AddItems.AddItemsDel = DelLoc.Loc WHERE AddItems.Printed=0 AND (SM.DateIn >= '05/28/2004' AND SM.DateIn <= '05/28/2004') GROUP BY DelLoc.Loc

I get:
[Microsoft][ODBC SQL Server Driver][SQL Server]'FIRST' is not a recognized function name.

If there a equilivent function? I can't use min or max because it does not give me what I need.

B
 
Thanks for the reply, but I ended up doing it with 2 queries. Thanks though
 
Look into the TOP keyword for SQL Server SQL syntax. It might give you what you need.

Code:
SELECT TOP 1 <field>....

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top