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
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.
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...
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
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.
i have a DB with table named Products. pCategory lists several names of teams of varing leagues (NBA, NFL, MLB, etc...) I want a table to display only the NBA teams. I have a field named pGroup which has NBA, MLB, etc... for each team. How can I display all fields where pGroup="NBA." I thought the code would work below, but it didn't.
<%sql_getProducts = "SELECT DISTINCT pCategory WHERE pGroup="NBA" FROM products"
I am building a real estate listingwhere the vistor choses a city or cities and the results display the counties they are in. The problem I have encountered is that I am trying to make search results from a query that displays the county only once even if the visitor has chosen many cities within the same county.
I problem is that when the county field is set to be distinct, the recordset pulls out only the first record of that group. Therefore, when a search is performed on that query it will not find a potenial county even if the city belongs to that county.
I have a table containing newsletter articles. Each article has a zone which is either a section, division, district or all, and a edition they belong to.
I have the following sql statement in my vbscript to give a list of newsletter edition dates if there are articles relating to the relevant section, division or district:
"SELECT DISTINCT (edition) AS editions, zone FROM t_newsletter WHERE ((zone='"+sec+"') OR (zone='"+dis+"') OR (zone='"+div+"'))"
the trouble is that if there is an article in november for the relevent section and also an article for the relevant district then that date appears twice - how can I stop this, or do I need to go into my database?
How can do double select or do I have to loop though? I would like to go an strSQL = * From main but I only want to have one person from each team in week x, team being a field. I could select distinct teams then loop and simply only Do while once per team however I'd like to put it all together but of course
Select Distinct TEAM Where Week = vweek
can not be done. Any ideas. I saw some thing about being able to have a second statement underneath in [] once but was I dreaming?
I have my piece of code like that...everything is working nice but when i retrieve values from the database, the DISTINCT part does not seem to work... Code:
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:
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"
I need help programming a search function. I want to narrow down a search function regarding time. I figure the best way to do this is to select a higher interval and a lower interval, and then have an sql function that grabs the times from within that range.Code:
sql = "SELECT DISTINCT place, time FROM bussystem WHERE time >= '"&timey&"'" Set rscurrent = Server.CreateObject("ADODB.Recordset") rscurrent.Open sql, conn, 3, 3
sql = "SELECT DISTINCT place, time FROM bussystem WHERE time <= '"&timey&"'" Set rsrecent = Server.CreateObject("ADODB.Recordset") rsrecent.Open sql, conn, 3, 3
sql = "SELECT DISTINCT LName FROM myTable ORDER BY userID"
But this produces an error saying you cannot use DISTINCT and ORDER BY in the same statement. What is the best way I can achieve a sorted list of unique values?
I will attach a zipped file with data in it. I want to pull distinct phone numbers from column B and column D (as some of the numbers will be the same). then rank by asc order based on TotalCashPrice. If they are the same, I want to compare the TotalCashPrice to TotalCashPrice2. Is that possible?
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?
I m trying to use select statement in order to select a distinct word like 'c', but in the database i only want to select c when it occurs on its own not when it appears in another word.
eg i need to select the alphabet 'c' in 'the cat category is c' but not the 'c' in 'cat' or 'category'. I have used the code below but this seem to count all 'c'
select set rsTypes2 = con.execute("SELECT COUNT(two) AS total FROM march where two like '%c%'")
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: -
please bare with me here: <% dim VAR(2) VAR(1)="nba" VAR(2)="mlb"
sql_getVAR = "SELECT DISTINCT pcity FROM VAR" Set getVAR = Conn.Execute(sql_getVAR) %>
I want several table according to the sport (nba,mlb, nfl etc...) I thought if i put the above code on an asp page (page02.asp) and then specified VAR on page01.asp with the link for NBA being /teams_02.asp?VAR=1 it would display the fields from the "nba" table. Of course it did not saying the error was that VAR was not defined. Can someone tell me what I am doin wrong or if you understand it, explain a better way to me.
I have a table [table] with two fields [type] and [ID]. I am trying to create a table with the number of IDs per distinct type. So, the return table would be {distinct [type]}, {count per {distinct [type]}. I am stumped; I believe this must be two queries?