473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

using count with top

Bam
hey gang.

i am trying to pull a count from the top 16 records in a db.

select count(top 16 (username)) as cnt2 from bracketdb_"&tourney_id&" where
username <'BYE' order by POS

this is what i need to do, however, it doesn't work. i am getting a systax
error near TOP.
this is using SQLdb

any ideas?

thanks
bam
May 27 '07 #1
2 3753
Bam wrote:
hey gang.

i am trying to pull a count from the top 16 records in a db.

select count(top 16 (username)) as cnt2 from bracketdb_"&tourney_id&"
where username <'BYE' order by POS

this is what i need to do, however, it doesn't work. i am getting a
systax error near TOP.
Well Duhh! :-)
Do you have Books OnLine (BOL)? If not, see:
http://www.aspfaq.com/show.asp?id=2229
this is using SQLdb
I'm not clear. Is there a possibility that the count could be LESS than 16??
It will never be more than 16, right? Try this:

Select count(*) from (select top 16 username from ... ) as q

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 28 '07 #2
Bam
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:u0**************@TK2MSFTNGP04.phx.gbl...
Bam wrote:
>hey gang.

i am trying to pull a count from the top 16 records in a db.
I'm not clear. Is there a possibility that the count could be LESS than
16?? It will never be more than 16, right? Try this:

Select count(*) from (select top 16 username from ... ) as q
yes and yes. it can be less than 16, but never more.

i used what you put there, and it seems to work fine.

Thanks once again Bob
May 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
1
by: kingster | last post by:
Hi, I have a regular dataset and all i want to do is make a pivot table display in a browser with the datasource of the pivot table to be this dataset and then the end-user will be able to do...
8
by: Andrew Robinson | last post by:
Are these two equivalent? Is one better than the other? I tend to go with #1 but started wondering.... Thanks, 1: using (SqlConnection cn = new SqlConnection(DataConnection)) using...
1
by: rllioacvuher | last post by:
I need help with a program. I have implemented that following header file with an unordered list using one array, but i need to be able to use an ordered list and 2 arrays (one for the links and one...
4
by: onecorp | last post by:
I have a SQL table comprised of 31 columns. The first column is simply an id column, the next 30 columns are labelled ,.... The numerical columns have a tinyint type and the data stored is either...
1
by: mabra | last post by:
Hi All ! Sorry for my crossposting, I am not completely sure about which group is really of any help. I started using the WUA COM API from C#. I created an interop assembly and my code compiles...
3
by: amitsoni.1984 | last post by:
Hi, I have to write a code in python to read a matrix from a text file and for that i am using following code. But it gives an error saying "NameError: name 'split' is not defined". Can anyone...
3
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display an array of objects using a GUI. My instructions are that the CD class and it's sublcass don't need to change I just need to modify class CDInventory to include the GUI. I'm not...
5
by: satyabhaskar | last post by:
hi all, In my web page i have created radio buttons dynamically on to the page .....following is my code string Course, Semester, Section; int rowsCount; string con =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.