Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

/proc/kallsyms format, sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas

Links

XODOX
Impressum

#1: SQLQuestion

Posted on 2008-04-04 11:09:45 by 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.

Report this message

#2: Re: SQLQuestion

Posted on 2008-04-04 15:15:36 by 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.

Report this message