SQLQuestion

SQLQuestion

am 04.04.2008 11:09:45 von Walid_38

Hi All,

I've a table that displays something like this:
clientid order OrderDate
-------- ------ ---------
1 Printer
2 mouse
1 monitor
3 printer
4 keyboard
2 keyboard

But I'd like to get this result:
Where I display the latest 4 orders in the same row.

clientid order1 order2 order3 order4
-------- ------- ------- ------ ------
1 printer monitor
2 mouse keyboard
3 printer
4 keyboard

Thanks for your help.

Re: SQLQuestion

am 04.04.2008 15:15:36 von reb01501

Walid_38 wrote:
> Hi All,
>
> I've a table that displays something like this:
> clientid order OrderDate
> -------- ------ ---------
> 1 Printer
> 2 mouse
> 1 monitor
> 3 printer
> 4 keyboard
> 2 keyboard
>
> But I'd like to get this result:
> Where I display the latest 4 orders in the same row.
>
> clientid order1 order2 order3 order4
> -------- ------- ------- ------ ------
> 1 printer monitor
> 2 mouse keyboard
> 3 printer
> 4 keyboard
>
> Thanks for your help.

What database (type and version please) are you using. The answer to
this question strongly depends on that information, which you should
make a point of supplying whenever you ask a database-related question.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.