General information
Forum:
Microsoft SQL Server
Title:
Grouping information, How?
Hello everyone!
I need some tips regarding how to get just a few records from a table, let me explaing...
I have a database called Categories, it has the following fields:
1) CATCOD, VAR(10)
2) CATDESCRIPTION, CHAR(20)
the look like this...
CatCod CatDescription
-----------------------------------
01000 Agriculture
01001 Agriculture - Plants
01002 Agriculture - Animals
02000 Automotives
02001 Automotives - parts
02002 Automotives - Dealers
03000 Travel
03001 Travel - Airplanes
My question is, how I could get just the 2 first code of CatCod and the CatDescription but not duplicating the CatCod, I want the next result:
CatCod CatDescription
-----------------------------------
01 Agriculture
02 Automotives
03 Travel
and upon try to use GROUP BY I don't get the result that I want.
Any sugestion please.
Thanks,
Gerardo
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only