Count Query As Well As Select Query

Nov 30, 2007

Hello All,

I'm currently developing a football team website and I'm created a player profile bit of the website linking to my Access Database.

Currently I have the following :

selectCommand="SELECT [playername], [favouriteposition], [picture] FROM [player] WHERE [playername] ='Smith J'

This means I can display John Smiths Name, Fav Position and his Picture from my player table.

I also want to count his stats (goals, starts, subs) but am not sure how to do this.

I have a table called playermatchevents which records matchID, playerID, shirtnumber, goals, starts, subs, mom

goals is a straightforward Number datatype field, whereas starts,subs and mom are a Yes/No datatype field.

Basically I want to keep my select query, but I also want to add to it that it COUNTS the number of starts, subs, goals and mom that that player has.

Pardon me if I haven't used the correct wording, I'm still quite new to all of this.

I would be very grateful for any help.

Thanks,

covcitydv

View Replies


ADVERTISEMENT

Combining Select Query And Count Query

Jul 26, 2006

Ok, hope you can help me with this one.

I have a select query that pulls data from one table that includes the following data

MOS Grade Required Authorized



I have a separate count query that pulls data from another table and counts the following data

MOS Grade Assigned

How do I combine these 2 queries so the results I get will be

MOS Grade Required Authorized Assigned


For instance:

Select Query Says

MOS Grade Required Assigned
25C E4 1 1
42A O3 1 1
38A E7 3 3


Count Query Says

MOS Grade Assigned
25C E4 1
42A O3 1
38A E7 2


I want the results to read

MOS Grade Required Authorized Assigned
25C E4 1 1 1
42A O3 1 1 1
38A E7 3 3 2


Hope you can help.

View 5 Replies View Related

Queries :: Select Count And Group Query

Sep 19, 2014

I have built a database that shows the purchase of items that have serial numbers, and so are unique. The database shows the purchase oe each item, and subsequent sale, including "Date In" and Date Out".

Each "item" however has a unique transaction reference (Stock No.) I would like to be able to show what items are currently in stock, and therein lies my problem.I am able to use a select count to find all the instances where the stock number there are two stock numbers (ie In and then Out), but have been unable to find a way to filter the records in a query, to show the stock currently held.

only Single instances of the "Stock No." appear in a table, as that would show the current stock held.I have tried numerous ways to achieve this but I have reached a dead end. I am not experienced in writing with SQL.

View 14 Replies View Related

Queries :: Select Query - Count How Many Records Not In Correct Format

May 7, 2013

So I have a table with around 20,000 records and there is a field which holds a phone number for each individual within the organization, I want to run a select query that counts how many are not in the correct format

The format is 10 digits and it must start with a 0

Using Access 2010

View 2 Replies View Related

Queries :: Update A Query Based On Results From Another Query Using Count Function

Apr 2, 2013

I run a physical therapy office and patients come in for treatment either 3, 4 or 5 times per week. My database is used to track these frequencies (among other things).

I have 3 queries which count how many patients come in 5, 4 and 3 times/week.

In my main table I have fields called "how many 5's", "how many 4's" and "how many 3's".

I have tried to design an update query which will update those fileds in my main table to reflect the counts in the 3 queries mentioned above.

(I'm not using SQL view, I'm using the query design view)

In the "update to:" row, I use the Build function and locate the count I'm looking for.

Problem: when I run the query I get the error: Operation must use an updateable query.

View 3 Replies View Related

Union Query - Generating From A Select Query ?

Jun 23, 2006

(This is a modified repost - which hopefully makes sense) I am using Access2003. I am trying to set up a fast method of creating a union query. I have a jobs table that stores info about jobs with a separate table for each job that pulls together info from elsewhere when a review is conducted. The tables are as follows (and are linked from a paradox DB) :-

Table Name: jobs
JobID (J000001, J000002, etc)
Status (Live, Filled, etc)

Review Tables

Table Name: J000001 / J000002 etc
Consultant: (Joe, Terry etc)
ObjectID: (RoberI, SmithJ etc)
Status: (H, P, D, R etc)

The jobs table contains information about jobs, including a unique code (JobID) that identifies the job. There is also a status filed that tells us whether the job is Live or closed etc.

The first time a job is reviewed a new table, a review table is generated, and the name of the table is the same as the JobID for that job. So Job J000001 has a review table with table name J000001 etc. The review tables may contain information with the same ObjectID (as they are unique fields from a third table – the candidates table)

I would like to generate a union query for all jobs in table jobs with a status of live. I can do this manually, if I review a list of live jobs, with the following sql expression;

SELECT ObjectID, Consultant, Status, "J000001"
as [JobNo] FROM J000001
UNION SELECT ObjectID, Consultant, Status, "J000002"
as [JobNo] FROM J000002
UNION SELECT ObjectID, Consultant, Status, "J000003"
as [JobNo] FROM J000003;

I can then append the info into a new table. However this query is run at least twice a day and things change.

I would like to know is there a means of automatically generating sql for the union query based on results of a query of the jobs table ?

Any help greatly appreciated.

View 2 Replies View Related

Bug With Wrapper Select Query On A Union Query

Sep 14, 2007

I have the following query:

SELECT UnionTable.groupby, UnionTable.SeqID, UnionTable.Actual
FROM (

SELECT VAP1.groupby, VAP1.SeqID, VAP1.SomVanbedrag as Actual
FROM qryVoorplaatActualPillar_Forecast AS VAP1

UNION

SELECT VAP2.groupby, VAP2.SeqID, VAP2.SomVanbedrag as Actual
FROM qryVoorplaatActualPillarIST_Forecast AS VAP2) AS UnionTablewhich is two select queries called UnionTable and a wrapper.
Access handles this very well. Until you look at the SQL statement. If you don't pay attention Access stores the next query
SELECT UnionTable.groupby, UnionTable.SeqID, UnionTable.Actual
FROM [

SELECT VAP1.groupby, VAP1.SeqID, VAP1.SomVanbedrag as Actual
FROM qryVoorplaatActualPillar_Forecast AS VAP1

UNION

SELECT VAP2.groupby, VAP2.SeqID, VAP2.SomVanbedrag as Actual
FROM qryVoorplaatActualPillarIST_Forecast AS VAP2]. AS UnionTable
Now when you want to execute the query you get an errormessage.
Has anyone seen this before? Is this a known bug or is it a feature? Is there a workaround?

View 1 Replies View Related

Crosstab Query Built On A Select Query

Jun 18, 2015

I have a crosstab query built on a select query.It works perfect. However, when I try to use the "Between [BegDate] And [EndDate]" it tells me access engine can not recognize it.If I use this in the actual select query it works fine. But when I try to use the crosstab query it gives me the above error.

Also, I'm using two undbound textboxes on a form for [BegDate] and [EndDate]. I have the syntax correct in my select query and it works fine. But it won't work with the crosstab query.

View 3 Replies View Related

Select Query + Insert Query

May 11, 2006

Hallo everyone,

I have two tables in the database table1(col1,col3,col2) and table2(col1, col2). First of all i will have to select col2 from database and for each and every value of col2 i need o make an insert query in the table1(..,..,col2).

It will be helpful for me if anyone call solve this problem for me.

aravind.s

View 1 Replies View Related

Select Based On Count

Sep 18, 2006

I am feeling really silly right now. This should be simple but .....

I have a problem i just simply can not get my head around. Hope some one can help.

There are two tables in this db.

There is a one to many relationship set up between them

I want a query that will show records in the parent table only when there are a specific number of related records in the child table.

Does anyone know if this can be done and if so how?

View 10 Replies View Related

Getting Query Criteria To Select All Records Or Specific Records In Query Design Section?

Jun 16, 2014

How can I get a Query Criteria To Select All Records or specific records in query design section.

I have a table that shows many departments with credit card transactions. I like to run a query to see specific department, or have an option to see all the departments when the query is run.

View 2 Replies View Related

Queries :: Select Query To Gather Results Of Other Select Queries

May 11, 2014

I'm fairly new to Access. 's various select queries containing useful and useless results. I want to create a select query that will pick out all the useful figures into a 1 row table that can then be pasted into Excel.

e.g Existing Select Query 1 returns 1 row showing Average Age, Average Price, Total rainfall
Existing Select Query 2 returns 1 row showing Average Weight, Average Salary, Total snowfall
Existing Select Query 3 returns *2* rows: It returns Distance from London, Hours daylight and population for Town A and Town B

I want a select query that returns 1 row showing (6 items):

Total rainfall, Total snowfall, Town A Distance from London, Town A Population, Town B Distance from London, Town B Population.

I've been able to handle getting Total rainfall and Total snowfall. But I cant figure out how to get Town A Distance from London, Town A Population, Town B Distance from London, Town B Population to appear in the same row of the same query results as Total rainfall, Total snowfall.

View 3 Replies View Related

Queries :: Select Count Duplicate Values By ID

May 23, 2013

I am using Access 2010 on a Windows 7 laptop. I need a query to provide a list of ID's that have more than one occurrence of IDandDate combined but haven't been successful getting past syntax errors.

Using this table structure as an example:
ID - defined as text field
Date - defined as date/time field
TestValue

This legacy table contains a record for each test. The table should be unique based on the ID and Date combination but was never restricted to that rule. I am converting to a new table but need to identify the duplicate entries so they can be addressed by business folks.

Access 2010 query.

View 1 Replies View Related

Queries :: COUNT With Select Distinct On Expression

Dec 9, 2014

I have the following SQL which returns rows of distinct numbers that are calculated from a field.

SELECT Distinct (Left([ProjectID],4)) AS NumberOfCalls
FROM tblProject;

ProjectID looks something like this : 1307-IND-001 and NumberOfCalls looks like : 1307

I need to count the number of unique "NumberOfCalls" entries that there are in a list of about 50 rows. Currently the SQL returns a list of numbers like this:

1307
1311
1401
etc...

I just want NumberOfCalls to show "3". Is there an easy way to do this?

View 5 Replies View Related

Select Those In A Column That Meets Character Count Criteria

Nov 4, 2005

Hey, I know this is probably a simple thing to do, but I couldn't find it anywhere on the web so hopefully someone here can help.

I have a column of UPC codes which are a bunch of #'s. I need to find the ones that have more than or less than 12 characters.

Thanks

View 2 Replies View Related

SELECT COUNT Data Type Mismatch Problem

Sep 11, 2006

Hi,

I'm trying to create a count on a tick box of products that have been reviewed, however, the SQL statment I am using (as I have for a couple of other counts will not work fo this dues to 'Data type mismatch' which I can only presume is due to the fact that is is a tick box....

SELECT COUNT (TechnicalServicestbl.RequestID) AS TotalAwaitingReview
FROM TechnicalServicestbl
WHERE (TechnicalServicestbl.[Current Status] = "Completed") AND ((TechnicalServicestbl.[Review]) = "No" )


I have used the same template for a different count of completed jobs of the day, which works fine so far as I can tell.

SELECT COUNT (TechnicalServicestbl.RequestID) AS CompletedJobsToday
FROM TechnicalServicestbl
WHERE (TechnicalServicestbl.[Current Status] = "Completed") AND (TechnicalServicestbl.[Date Complete]=Format(Now(), "mm/dd/yyyy"));

View 1 Replies View Related

Count In Query

Jul 5, 2005

how can i count the number of rows in a query.
i have a query that return me number of rows. i want to count the rows.
when i try to count it, it gave me a column that count only her column. which mean in every row it counts me '1'.
i want to count all the rows.

View 4 Replies View Related

Count Query

Dec 9, 2005

I know this might sound stupid but I really can't find it anywhere. How do you count how many times a query is run.

I need to make a DoCmd.RunSQL stringname and count it so that I can loop it to match a certain number. Is that possible?

View 2 Replies View Related

Count Query

Dec 14, 2005

Hi everyone,

I wonder if someone could help me.

I am trying to write a query for a hospital database which counts the number of patients who received various treatments throughout their stay in intensive care. I think I will have trouble explaining textually what I would like to achieve so I have attached a Word document which should illustrate my requirements sufficiently.

If anyone could help me I would be extremely grateful.

Many thanks and best wishes
Russell

View 1 Replies View Related

COUNT 0 Query

May 27, 2006

Ive got something like this table:

TourID Language ClientID

2000 German 213
2000 French 245
2000 Spanish 286
2100 German 289
2200 French 259
2200 Italian 246
etc...

Does anyone know how to count the specfic data in a field, I want to be able to count e.g. how many italian in tourID 2000? i have some idea of using the count function but how do u display zero??

Thanks in advance.

View 1 Replies View Related

Help With Count Query

Aug 4, 2006

Hello everyone,

I have a table Deliveries with 4 columns;
CarNo (text), Name (text), DeliveryDate (number), ReceivingDate (number).

I need help with a query which summaries;
total number of deliveries,
deliveries on time (DeliveryDate = ReceivingDate )
late deliveries (DeliveryDate < ReceivingDate)
early deliveries (DeliveryDate > ReceivingDate)

So the out put should be like;

CarNoNameOnTimeLateEarlyTotal
3Taxi1053 18

So far I only managed to get the figures from 4 separate queries, and its really time consuming to collect all figures in one report.


Regards
Peter

View 2 Replies View Related

Count In A Query

Aug 17, 2006

I have a query that I want to get some totals on in a certain date range.

The fields in the query are:
SystemGroup
Problem
FaultCount
Date

Under Fault Count there is a possibility of two answers: Cosmetic or Mechanical

What I would like to do in the query is after I run the Query between two dates
I would like to see what my two totals are for Cosmetic Faults and Mechanical Faults.

I thought I had an expression that would work but it will not work. I am stumped.

So bottom line: after I run the query I would like to see:
Total Faults = ??
Cosmetic = ??
Mechanical = ??

Thanks in advance

View 1 Replies View Related

Count Query

Sep 29, 2006

I have setup a count query and only want it to count a number if it is not a 0.The count query seems to still count 0's.

How do i set the criteria so that 0's don't get counted?

View 2 Replies View Related

Query Count

Mar 1, 2007

I would like to know if anyone knows if I can create a query that will give me a count of the number of queries within my access DB?

Thank You

View 2 Replies View Related

Count Query

Mar 29, 2007

Hi

I am running a count query at the moment which shows the number of classes booked for each faculty. The query is as follows:

SELECT Audited_Week02.Faculty, Count(Audited_Week02.Faculty) AS CountOfFaculty
FROM Audited_Week02
GROUP BY Audited_Week02.Faculty;

So when the query is run the following data view appears:

FacultyCountOfFaculty
AAD3
BAL2
CSE51
HLS78
N&M42
TO22

Which is fine, however there is another query as well which shows all the classes that didn't take place for these faculties, therefore I want to include this as well. So I have tried:

SELECT Audited_Week03.Faculty, Count(Audited_Week03.Faculty) AS CountOfFaculty, Summary_W02.Faculty, Count(Summary_W02.Faculty) AS CountOfFaculty1
FROM Audited_Week03, Summary_W02
GROUP BY Audited_Week03.Faculty, Summary_W02.Faculty;

But when I run the query I get the following data view:

Audited_Week03.FacultyCountOfFacultySummary_W02.FacultyCountOfFaculty1
AAD26AAD26
AAD104CSE104
AAD26HLS26
AAD104N&M104
AAD130TO130
BAL118AAD118
BAL472CSE472
BAL118HLS118
BAL472N&M472
BAL590TO590
CSE58AAD58
CSE232CSE232
CSE58HLS58
CSE232N&M232
CSE290TO290
HLS8AAD8
HLS32CSE32
HLS8HLS8
HLS32N&M32
HLS40TO40
TO4AAD4
TO16CSE16
TO4HLS4
TO16N&M16
TO20TO20

When it should be:
FacultyCountOfFaculty FacultyCountOfFaculty
AAD3 AAD 2
BAL2 BAL 0
CSE51 CSE 8
HLS78 HLS 2
N&M42 N&M 8
TO22 TO 10


The other possibility is to create a separate query for classes that didn't take place then create another query which joins these 2 up. As you can see it will start to get confusing so it would easier if classes that are booked and classes that didn't take place were in one query.

Is this possible, because there are altogether 25 weeks of data that need to be counted?

thanks

View 4 Replies View Related

Help With Query -- Count ??

Apr 21, 2007

I have a problem I need some help with. I have a table that keeps trades for the day:
TDate TTime Type Amount. The type is L for Long, S for short. Multiple trades occur each day. I want to summarize each day to a single record:

Date TradeCnt Longs Shorts Amount

My problem is how do I count the number of Long (L) trades and the number of Short (S) trades. Heres where I'm at:

SELECT TDate, count(TDate), ??Longs Shorts?? Sum(Amount) FROM tblTrade GROUP BY TDate

How do I do the Longs and shorts, thanks in advance !!

Tony

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved