Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 GROUP BY function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-03-31 : 08:47:27
shane writes "Hello,

I have written this SQL statement, and it works fine.

SELECT dbo.items2.description, dbo.dogs.sections, dbo.items2.itemnumber, dbo.items2.catC, dbo.items2.price, dbo.items2.vendor
FROM dbo.items2, dbo.dogs
WHERE id = 'MMColParam' AND dbo.items2.catB = 'MMColParam' GROUP BY dbo.items2.vendor, dbo.items2.description, dbo.dogs.sections, dbo.items2.itemnumber, dbo.items2.catC, dbo.items2.price


however, it displays the data like this:

(Section)

(Vendor)
(Itemnumber) (description)
(Vendor)
(Itemnumber) (description)
(Vendor)
(Itemnumber) (description)





The vendors are grouped alphabetically which is fine, but i only want each vendor name listed one...like this:

((Section)

(Vendor)
(Itemnumber) (description)
(Itemnumber) (description)
(Itemnumber) (description)

(Vendor)
(Itemnumber) (description)
(Itemnumber) (description)
(Itemnumber) (description)


Any suggestions? I would really appreciate it..thank you.
shane"

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-03-31 : 09:36:41
That's really a display issue and should be handled in the front end. If you are passing XML to the front end, you could accomplish what you are doing by setting Vendor as the Parent Node and using for xml. Other than that, you need to handle it on the application side.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -