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
 Transact-SQL (2000)
 query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-12 : 09:43:38
ravi writes "i have a table with the following columns

name      address age salary
xxx [ 234 23 3000]
yyy [ s23 34 4000]
kkk [ 89f 23 5000]
xxx [ hjf 23 5433]
xxx [ ysd 22 3000]
yyy [ ahj 11 9000]



i want to write a query so that the output is in the following
format

xxx       [234  23  3000]
[hjf 23 5433]
[ysd 22 3000]

yyy [s23 34 4000]
[ahj 11 9000]
kkk [89f 23 5000]



NOte : i dont have a primary key in the table "

andre
Constraint Violating Yak Guru

259 Posts

Posted - 2002-03-12 : 09:52:57
The closest I can think of is this:

SELECT name,address,age,salary FROM Table1 GROUP BY name ORDER BY name; 




Edited by - andre on 03/12/2002 10:06:40
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2002-03-25 : 11:57:43
>> Note : I do not have a primary key in the table <<

Then, by definition, this is not a table. You are trying to use SQL to write reports and SQL is not a report writer. Formatting output is a job for the front, not for the database. You need to get a good book on SQL and learn the basic concepts of the language.



--CELKO--
Joe Celko, SQL Guru
Go to Top of Page
   

- Advertisement -