Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / October 2007



Tip: Looking for answers? Try searching our database.

SQL ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paulo - 11 Oct 2007 18:40 GMT
Hi, I need to create a ranking column wich will be the row number... it is
the seller wich most sells... example below:

NOME_EMPRESA   Ranking   NOME_PROMOTOR   VL_CREDITO
EMPRESA                 1              Paul
2.212,00
EMPRESA                 2              Robert
1.500,00
EMPRESA                 3 ....

"Select Empresa.NOME_EMPRESA,Vendedor.NOME_VENDEDOR
NOME_PROMOTOR,Sum(CONTRATO.VL_CREDITO) VL_CREDITO";
" From Contrato,Empresa,Vendedor Where
CONTRATO.COD_EMPRESA=EMPRESA.COD_EMPRESA And ";
"Contrato.COD_VENDEDOR=VENDEDOR.ID_VENDEDOR Group By
NOME_EMPRESA,NOME_VENDEDOR ";
"Order by VL_CREDITO Desc";

Is there any way creating on the sql the column ranking with the number?

Or must I create a separated DataSet and manipulates/populating it ?

Thanks
Bob Barrows [MVP] - 11 Oct 2007 19:19 GMT
> Hi, I need to create a ranking column wich will be the row number...
> it is the seller wich most sells... example below:
[quoted text clipped - 16 lines]
> Is there any way creating on the sql the column ranking with the
> number?

It depends on the database type and version.

> Or must I create a separated DataSet and manipulates/populating it ?

DataSet? Are you talking about ASP.Net? If so, you should follow up in
the dotnet group:

microsoft.public.dotnet.framework.aspnet.
There are also forums at www.asp.net where you can find a lot of people
to help you

Signature

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.

Paulo - 11 Oct 2007 19:24 GMT
Using SQL Server 2000

Yes Im using .net, but if you tell me the only way is creating a second
RecordSet and populating it I do it via programming...

Just want to know if it is possible to be done via pure SQL...

Thanks man!

>> Hi, I need to create a ranking column wich will be the row number...
>> it is the seller wich most sells... example below:
[quoted text clipped - 27 lines]
> There are also forums at www.asp.net where you can find a lot of people
> to help you
Bob Barrows [MVP] - 11 Oct 2007 19:46 GMT
> Using SQL Server 2000
>
> Yes Im using .net, but if you tell me the only way is creating a
> second RecordSet and populating it I do it via programming...
>
> Just want to know if it is possible to be done via pure SQL...

Well, I'm not really sure why you don't use the ordinal position of the
datarow in the datatable, but ...
http://databases.aspfaq.com/database/how-do-i-return-row-numbers-with-my-query.html
Signature

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.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.