abi_learn_vba
Board Regular
- Joined
- Nov 6, 2009
- Messages
- 215
Hi,
I have below table which has data arranged in sequential order of date.
<TBODY>
</TBODY>
Here i need Sort by Date and then Group by the ID together that my results of the query should look like the one below. Where A3 ID is grouped together until 2/11/2013 and A1 ID starts from 2/10/2013.
<TBODY>
</TBODY>
I tried many using Order by and group by without success, can any one help me with a query for this?
Thanks in Advance
-Abi
I have below table which has data arranged in sequential order of date.
Table1</SPAN> | |
Date</SPAN> | ID</SPAN> |
2/1/2013</SPAN> | A3</SPAN> |
2/2/2013</SPAN> | A3</SPAN> |
2/3/2013</SPAN> | A3</SPAN> |
2/4/2013</SPAN> | A3</SPAN> |
2/5/2013</SPAN> | A3</SPAN> |
2/6/2013</SPAN> | A3</SPAN> |
2/7/2013</SPAN> | A3</SPAN> |
2/8/2013</SPAN> | A3</SPAN> |
2/9/2013</SPAN> | A3</SPAN> |
2/10/2013</SPAN> | A1</SPAN> |
2/10/2013</SPAN> | A3</SPAN> |
2/11/2013</SPAN> | A1</SPAN> |
2/11/2013</SPAN> | A3</SPAN> |
2/12/2013</SPAN> | A1</SPAN> |
2/13/2013</SPAN> | A1</SPAN> |
2/14/2013</SPAN> | A1</SPAN> |
2/15/2013</SPAN> | A1</SPAN> |
2/16/2013</SPAN> | A1</SPAN> |
2/17/2013</SPAN> | A1 </SPAN> |
<TBODY>
</TBODY>
Here i need Sort by Date and then Group by the ID together that my results of the query should look like the one below. Where A3 ID is grouped together until 2/11/2013 and A1 ID starts from 2/10/2013.
Query Results</SPAN> | |
Date</SPAN> | ID</SPAN> |
2/1/2013</SPAN> | A3</SPAN> |
2/2/2013</SPAN> | A3</SPAN> |
2/3/2013</SPAN> | A3</SPAN> |
2/4/2013</SPAN> | A3</SPAN> |
2/5/2013</SPAN> | A3</SPAN> |
2/6/2013</SPAN> | A3</SPAN> |
2/7/2013</SPAN> | A3</SPAN> |
2/8/2013</SPAN> | A3</SPAN> |
2/9/2013</SPAN> | A3</SPAN> |
2/10/2013</SPAN> | A3</SPAN> |
2/11/2013</SPAN> | A3</SPAN> |
2/10/2013</SPAN> | A1</SPAN> |
2/11/2013</SPAN> | A1</SPAN> |
2/12/2013</SPAN> | A1</SPAN> |
2/13/2013</SPAN> | A1</SPAN> |
2/14/2013</SPAN> | A1</SPAN> |
2/15/2013</SPAN> | A1</SPAN> |
2/16/2013</SPAN> | A1</SPAN> |
2/17/2013</SPAN> | A1</SPAN> |
<TBODY>
</TBODY>
I tried many using Order by and group by without success, can any one help me with a query for this?
Thanks in Advance
-Abi