Count Records With Distinct Values
I have got an access database with 100's of records in it(each record is just one word/phrase)...i am looking to develop some asp code that will select all distinct values in that table and list the number of times that text appears.
For example in the table contains the following records: -
banana
apple
orange
apple
apple
orange
apple
I want the following output: -
apple - 4
orange - 2
banana -1
View Replies
ADVERTISEMENT
I want to select just one field to display using sql and I want to have another variable that counts how many fields of the same value there are. My code looks something like this but i'm getting an error...
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal. Code:
View Replies
View Related
I tried to count distinct colum such as department using following sql:
select COUNT (distinct Department) from table university1;
it cannot recognized distinct and failed. I count to count unique department number, I knew the sql worl for Oracle but not Access DB. Any idea to fix that?
View Replies
View Related
Some values in my array are repeating. Is there a way to select distinct values from the script like you can in sql?
View Replies
View Related
i am inner joing two tables customer and program. if i use select distinct i still get duplicate records displayed. how can i display distinct records for a customer by cust_no but still pull fields from program.
my customer and program table are joined by the cust_no field but in the program table the customer may have 10 different programs.
I tried "Select DISTINCT customer.cust_no ,customer.lastname, customer.firstname, program.season inner join program on customer.cust_no = program.cust_no"
View Replies
View Related
How do i Count Records with "the same values"?
Name, Age, Sex
John, 20, M
Barry, 24, M
Eve, 19, F
How do i Count the Males and Females?
Like "There is currently 2 M and 1 F registered"
To count them all I would just use rsTable.RecordCount, but dont know how to Count them the way i want them to.
View Replies
View Related
Course_Info and Students. Course_Info holds all the information for each course that a student can sign up for. The Students table holds all of the student’s information. The field that ties the two tables together is Course_Name.
I have an admin page that I would like to display the total number of students enrolled for each class. How can I count the records in the Students table, and then display the total number of students that are enrolled in each individual classes?
View Replies
View Related
I want to add an include line to my main page to veiw how many sites is in my database..
This what I came up with for example:
<!--#INCLUDE FILE="DBCONNECTION.ASP"-->
<%
DIM SQL,RS
SQL = "SELECT COUNT(URL) FROM TABLE1"
SET RS = SERVER.CREATEOBJECT("ADODB.RECORDSET")
RS.OPEN SQL, CONN, 3, 3
%>
How can i show the number only in my main page...
View Replies
View Related
I am trying to count all the records that have the dates of 6/21/04 - 6/27/04. I am using:
sql = "SELECT Count(datecreate) AS ct " &_
"FROM Database_Name..TableName WHERE datecreate = '6/21/04' OR datecreate='6/22/04' OR datecreate = '6/23/04' OR datecreate = '6/24/04' OR datecreate = '6/25/04' OR datecreate = '6/26/04' OR datecreate = '6/27/04' GROUP BY LastName "
It only counts the records woth the date 6/21/04. Does anyone know how to fix this or a better way to do this?
View Replies
View Related
I've got query which returns a bunch of dates, like this:
12/05/05
12/05/05
12/05/05
11/05/05
What I want is to find the largest number of same entries and store this number in a variable: so, for the example above, I'd want my variable to equal 3. Code:
View Replies
View Related
I'm trying to count the number of records in a database table but I keep getting the result of -1 which is incorrect. I'm sure this is a simple thing but I'd appreciate any ideas. The code is as follows:
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open (Server.MapPath("..databasesphonebook.mdb"))
set rsCount=Server.CreateObject("ADODB.Recordset")
rsCount.open "RoleCodes", conn, adOpenStatic
response.Write(rsCount.recordcount)
View Replies
View Related
I know I've asked this before, and other people have too. But when I use that igrep search thing, almost all of the search results are scambled (when you clikc on a search result, its just a scambled up thread).So I'll ask again, because I have forgotten. I know that to count the entries in a recordset, you usethe following code...Code:
RS.RecordCount
But I know that you need something else, something about a client-side pointer? Without it Im just receiving -1 each time.
View Replies
View Related
I have created a simple search engine which retrieves records from an access database using sql and displays them using ASP.How do I go about counting the number of records that have been retrieved?
View Replies
View Related
I have been using the following code to count the number of rows returned from a query:
Alldata = rs.Getrows()
NumRows = Ubound(Alldata, 2)
The problem is I am now having to limit the number of rows that it returns:
Alldata = rs.Getrows(300)
Now my NumRows always equals 300 no matter how many matches are found so my counter doesn't work. Does anyone know a way around this?I know that I can use SELECT COUNT(*)..... instead in an SQL query but that means making two trips to the server which I don't really want to do.
View Replies
View Related
I think this should be simple but cannot find it:
I use a update query like
sSQL = "UPDATE PLAATSEN SET PROVINCIE='1' WHERE PROVINCIE='Noord-Brabant'"
ADORSEXECUTE(sSQL)
2 things I want to do, check if query is success and display message with number of changed records. How can I do this?
View Replies
View Related
Trying to duplicate the functionality found on this page:
I have a new table i've created that stores peoples search queries:
INDEX, SEARCH, COOKIEID, CID, SUCCESS, DATE
I have a seperate table that stores my product data, including the keywords. My search function uses a LIKE %%examplekeyword to match searchs to the DESCRIP column in this inventory table.
How can I make one SQL query to display the same results as on the the example page? It's easy enough to SELECT the results, but how do I do a count of how many instances of that search word exist, inside the same SQL statement?
View Replies
View Related
I have the following code to check if a field number matches a specific value. here is the code:
View Replies
View Related
This is the code of the page that should display a column of records (categories of my blog), next to the number of articles contained in each category. Code:
View Replies
View Related
I'm trying to count all the records in a table [for which I'm using count()]and display a number for each record. Ofcourse the number is not being pulled from the DB. So my doubt is when we display all the records of the DB can we just assign 1,2,3.... to each record that is being displayed? Code:
View Replies
View Related
i have some problem in showing data. I have two tables
First table(containing Hosting categories)
Second table(Containg catagories data lik
url,keyword,description.....etc)
I want to display catgories names from first table and then diffrent catagories
total records from second table, like this
ASP.NETHosting(10)
Linux Hosting(20)
Windows hosting(13)
View Replies
View Related
I have a registration form that I'm making and I need to get the count of available spots for each class session. I can't get the array to return something like "0,0,0,0,0,0". Is there a way to do this? There are 6 total classes and they are named 1, 2, 3, 4, 5, and 6.
When you start out, each count will be 0 (meaning no one signed up yet) which makes the openSpots variable equal to 35 (maximum # allowed). Code:
View Replies
View Related
how do i count the number of values sent accross the form post seperated by commas ?
e..g 43352352,325324452,235234452,24523454
View Replies
View Related
how can i Count and display number of records in table?
View Replies
View Related
I want to add intQuantity of all records that have the same prodID. I have tried all sort of variations but I don't seem to get it. I would imagine that it must be simple, that's why I can't get it.
SELECT SUM ( intQuantity) AS ItemTotal
FROM tblOrders
WHERE prodID = ? no clue
Or can I do that in ASP? doing something like (my example doen't work)
<%= (rsOrders("intQuantity") + rsOrders("intQuantity")) %>
in the mean time I'll be looking around for an answer to my lack of know how.
View Replies
View Related
I have buil a app that records types of transactions.
Each transaction has a specific type and also a DATETIME value attached.
I can display and work out calculations on all the data but I do not know who to sperate this into doing calculations for the previous days, week, month ext..
This is where I really need your help.
Can you please instruct me in how to do this, what im thinking is where the user can enter or select the days date thay want to look at and then this quiries the informatio where the date is within this critetra. (the same for week or month also)
Another problem for this is how can I have a something on the page which automatically tells it look at yesturday only, how does the computer know what yesturday will be, will the user need to enter yesturdays date in a specific format?
ANY HELP WOULD BE REALLY GREATFUL as I have a short time to put this historic information viewer togther.
View Replies
View Related
I was wondering if you could help me with the following problem. I have 2 listboxes in my
webpage, 1 has cities, and the other lists the streets of the city from the first listbox.
When I click on a city, I want the 2nd listbox to populate with all streets in the city. The city and streets are saved in a database, so when the user selects the city, I will run a query on the database and populate the 2nd listbox with all streets.
How can I do this with normal ASP? I know how to do this with ASP.NET, but don't know how to activate this with normal ASP?
View Replies
View Related
I have a Drop Down box that is being populated using the SQL Distinct
command. How do I get it so it doesn't show Null values?
Here is my SQL statement
sSQL = "SELECT DISTINCT Title FROM Everyone ORDER BY Title ASC"
View Replies
View Related
this is my query
SELECT distinct(prof.id_num),prof.name,education.educ_lev el,education.school,education.degree,agency_info.c ampus
FROM prof inner join education on prof.id_num=education.id_num inner join agency_info on education.id_num=agency_info.id_num where education.educ_level<>'course' and agency_info.campus='colle'
ORDER BY education.school
course="tertiary"
still it shows duplicate records. it displays secondary,primary record of the employee
View Replies
View Related
When I just - SELECT DISTINCT atblProducts.ID AS ProductID, it selects distinct Product IDs but when I add other columns to the select, it doesn't select the ProductID as DISTINCT.
I've heard to try "GROUP BY..." Code:
View Replies
View Related
I want to use a distinct and a top in a select statement, however I
want the distinct to only apply to one of the columns. For example
SELECT DISTINCT TOP 15 col1,col2,col3,col4 from table1
I only want the distinct to apply to say col2. Is there a way to do
this?
View Replies
View Related
I am trying to draw out from the database a distinct artists in relation to a variable which is 'cat'.
strsql = "SELECT distinct art_Artist, cat_ID, art_Category, art_Title, art_BDescription, art_Price, art_PicFull " &_
"FROM eventDisplay WHERE art_Artist='" & cat & "' "&_
"ORDER BY art_Artist"
Whats happening is that at this moment cat = Lee Jones, and he is in the databse three times with exactly the same info except for one subject which doesnt matter in this case, therefore we only need to see his name once being pulled.
Im sure this code has worked before but it doesnt seem to be workign here, i thought maybe its because his name is entered into the database with a gap inbetween his first name and last, but im probably wrong...
View Replies
View Related
I have information in a database with the following structure:
3 Divisions - each division has several districts. Each district has several regions and each region has several areas.
I have a recordset of every area with the region, district and division they belong to.
I have 4 drop down menus on my page - area region, district and division.
How can I filter my recordset before each dropdown, so it only has DISTINCT records
View Replies
View Related
Here is the code that just won't work
Set rsPlayers = cnnDB.Execute("SELECT DISTINCT Players.PlrEmail FROM Players INNER JOIN Sessions ON Players.PlrID = Sessions.SsnPlrID WHERE Sessions.SsnGmID = 14 AND Players.PlrEMail <> 'Unknown' ")
If I use SELECT * From Players I get duplicates. I only want unique emails for the query.
View Replies
View Related