PDA

View Full Version : repeting values in group by clause



waqas
06-08-2015, 01:38 AM
I have one query. I calculated some columns by aggregate sum function. In one column i want to get only one value instead of repeting again and again.

A 6 8 Ahmad
A 7 9 ali
A 4 2 tariq

I want to see A one time with first value.

jonh
06-08-2015, 01:52 AM
If you want to show
A 6 8 Ahmad
use

SELECT top 1 * FROM Table1

You can't group text unless the values are identical.

If you want
a 17 19

You'll have to drop the text field.

waqas
06-08-2015, 04:26 AM
If you want to show
A 6 8 Ahmad
use

SELECT top 1 * FROM Table1

You can't group text unless the values are identical.

If you want
a 17 19

You'll have to drop the text field.

No i want all value but a should be one time

jonh
06-08-2015, 06:20 AM
All what values? Show a before and after.
If you can't explain it I can't help you.

edit

SELECT top 1 * FROM Table1 where fieldX= 'A'

waqas
06-08-2015, 11:06 AM
All what values? Show a before and after.
If you can't explain it I can't help you.

edit

SELECT top 1 * FROM Table1 where fieldX= 'A'

I dont want only one row i need all rows with single A as a group value.

jonh
06-09-2015, 01:23 AM
Sorry, I have no idea what you mean.