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!

Select Group by issue

Status
Not open for further replies.

inarobis

IS-IT--Management
Joined
Apr 3, 2006
Messages
71
Location
CH
Hello

I have this data and I would like to group them

Have these record

Date ID A B
12.07.2005 1 450
12.07.2005 1 124
12.07.2005 2 340
12.07.2005 2 145

How I can Have this

Date ID A B
12.07.2005 1 450 124
12.07.2005 2 340 145


the table is ROOM

Can Someone help that issue?

Inarobis
 
How about this?

Code:
select tmp1.DateField, tmp1.RecordID, tmp2.A, tmp3.B
from 
  (select DateField, RecordID
  from [i]tablename[/i]
  group by DateField, RecordID) tmp1
join 
  (select DateField, RecordID, A
  from [i]tablename[/i]
  where A is not null) tmp2
on tmp1.DateField=tmp2.DateField 
and tmp1.RecordID=tmp2.RecordID
join 
  (select DateField, RecordID, B
  from [i]tablename[/i]
  where B is not null) tmp3
on tmp1.DateField=tmp3.DateField 
and tmp1.RecordID=tmp3.RecordID
 
thank you for your answers :D



Ina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top