Excluding Data From A Query
Jul 30, 2006
Could someone please help me? I am trying to run a query in which I would like to exclude a particular person's name from the query. For example, I am entering productivity information for each employee and manager each day, however, I only want the employee information to appear in the reports each day. Is there anyway of excluding a name from a query?
Thanks:)
View Replies
ADVERTISEMENT
Dec 4, 2012
I am building a query with a column of data, 'location number'.
I need to exclude any data where the location number is found in a pre-built table.
i.e. return all data except when the location number is found in the table.
View 3 Replies
View Related
Aug 6, 2015
I have a search form with 12 fields. In my query I use
Code:
Like "*" & [Forms]![CustomerRetestDatabaseSearch]![RetestLocation] & "*" Or Is Null
for each field on the search form.
I get the results I expect, it finds all records that match the criteria. Even if some of the fields in a record are null.
But if the query finds a record that matches one field I enter criteria into, and nulls for the other fields I enter criteria into it displays the record. I want to show exact matches. (If what I entered is null... don't show the record).
The reason I have "Or Is Null" is to include the records for the fields I left blank on the form.
Search Form with Criteria.PNG
Search Query.jpg
Search Results With Missing Entered Criteria(Dont Want These Records Included).jpg
View 2 Replies
View Related
Mar 26, 2006
I have designed an invoice for a project that shows the amount of money needed to be paid, some of this has already been paid and some hasnt, how am i able to make it so that the values that have been paid and therefore have been checked are not include in the query. please help.
View 1 Replies
View Related
Mar 1, 2007
I have created a query showing locations of a company's facilities, and product groups associated with that facility. Unfortunately the the products groups are located in one column and, if the facility produces more than one product, the product group is divided by a |, as shown below:
CABLE TRAY SECTION [05CT]|STEEL CONDUIT AND ELECTRICAL METALLIC TUBING SECTION [05RN]
In my query, I only want to show the product code, which I resolved by creating another table and associating the code with the product group. However, this query will exclude those plants that produce multiple products. How can I show just the product codes for all the facilities, including those with multiple product groups?
In otherwords, I would like the above example to look like this: 05CT|05RN (or something similar to this).
View 4 Replies
View Related
Aug 9, 2006
How can I run a query on the table attached to show the number of UR's that were operated on. As you can see some of the UR have more than two procedure dates so I want to exclude duplicates. i have tried "count" but that just gives a "1" value for each UR on each procedure date
View 1 Replies
View Related
Sep 24, 2005
I have a table with RandomID, EmpID, CompanyID. Some Companies will have great than 25 employees. I need to setup a query where I can randomly select all employees from all companies whos employee count is less than 25.
I have tried the following:
SELECT top 10 percent Count(*), empID
FROM tlbCompany
Group By empID
HAVING Count(*)<25
ORDER BY rnd(RandomID);
This counts the total number of employees, so if a company has 10 employees, it will only display one of the them.
Can this query be done?
And, what am I doing wrong?
Thanks to all that help....
Enviva..
View 5 Replies
View Related
Jan 16, 2015
Trying to build a CRM system for the office but am getting stuck with the below...
Each company (tblCompany) in the database has at least 1 enquiry (tblEnquiries) linked to it and normally at least 1 (sometimes 0) people (tblPeople).
I have a form which loads company specific information e.g. notes/quotes/orders/people/enquiries. All data is loaded based on the company unique id (c_id).
The attached image shows Company 1 (c_id = 1). It has 6 enquiries. However the subform only displays 5 of these. It does not display any which do not have a person (or p_id) linked to it - this is consistent throughout the database. I have included the table relationships and the enquiry as well in case they are needed!
Searching the net seems to suggest 2 possibilities:
1 - the relationship join type needs to be set to include all from tblEnquiries and only those from tblPeople where joined fields are equal, however changing the join properties does not appear to have an effect.
2 - table field types do not match (all _ID fields are set to number, unique numbers only).
[edit]: am using Access 2010!
I have re-designed the query to pull through tblEnquiries and tblPeople data based on the c_id field on the open form, which is now showing all records, including those not assigned to a person.
However, in the form I can select one from the query datasheet and open to see additional info. Those without a blank p_id number do not open, I receive the error:
"Run-time error '2113': The value you entered isn't valid for this field.
All _id fields are set to numeric so am not sure how to correct this?
View 2 Replies
View Related
Sep 27, 2005
Table1 gives Case Nu.
Table2 gives Case Nu. and EventType.
Table3 gives EventType and Cleared (yes/no field)
I want to run a query that gives Case Nu and Event where if there is even one event marked Cleared for a Case, then that case number and its events (even those not marked cleared) don't show up at all.
Any ideas? I know there must be an obvious solution, but my mind is stuck right now!
View 2 Replies
View Related
Jul 23, 2015
I want to run a query on a table that holds all speed information for our trucks imported from a third party. Some of the speed alerts in that table are not correct so we set up a second table managed by the users to enter a speed exception. So if we know that Main St in Dallas TX generates false alerts for speeding we know not to call the driver, the third party db speed limit is not up to date.
So I want my query to pull all the speed data from tblSpeedData, except leave out the records where the street and zip are listed in the tblSpeedExceptions.
View 3 Replies
View Related
Oct 11, 2012
I am trying to limit the results of a SQL query by date. I would like to take the current date from the system clock, move back one day, check to make sure it's not a weekend or holiday, then use the result date to limit the results in my Query. If the current date minus one day happens to land on a weekend, the date picked should be the Friday before the weekend. If the current date minus one day lands on a holiday, it should be the date before the holiday as long as it is not a Saturday or Sunday (on another holiday) .
Here is my SQL query right now.
SELECT DISTINCT (Mid(ClientDiv.Client_Division,1,3)) AS ABC, RTIClientTracker.EMB_OOB, RTIClientTracker.OOB_Fixed
FROM ClientDiv INNER JOIN RTIClientTracker ON ClientDiv.ID = RTIClientTracker.Client_Division
WHERE (((RTIClientTracker.Division_Region)='RTI') AND ((RTIClientTracker.Cut)>=Date()-1))
ORDER BY (Mid(ClientDiv.Client_Division,1,3));
It limits what it selects by using the current Date minus one day.
I need to skip over Saturdays, Sundays and Holidays.
View 8 Replies
View Related
Feb 28, 2006
Hi All,
I'm trying to extract records that start with 10 but I need to exclude all that start with 1011,1015 & 1025
so far I can only extract records that I need but cant exlude the others when I use the SQL below
INSERT INTO tblConceptOrders ( TA_TASK_ID )
SELECT dbo_F_TASKS.TA_TASK_ID
FROM dbo_F_TASKS
GROUP BY dbo_F_TASKS.TA_TASK_ID
HAVING (((dbo_F_TASKS.TA_TASK_ID) Like "10*"))
ORDER BY dbo_F_TASKS.TA_TASK_ID;
I'm looking for a better way to exclude the records I don't want & collect the ones that I do
Any help will be appreciated
thanks :)
View 6 Replies
View Related
Feb 13, 2008
Good morning,
I'm trying to create a query and I'm asking for specific records, but also need to exclude certain records within that criteria. Here is my Select statement:
SELECT [MD IMPORT PURGE PEND].PROC,
[MD IMPORT PURGE PEND].SEG,
[MD IMPORT PURGE PEND].NAME,
[MD IMPORT PURGE PEND].GROUP,
[MD IMPORT PURGE PEND].BEN,
[MD IMPORT PURGE PEND].DATE,
[MD IMPORT PURGE PEND].RISK,
[MD IMPORT PURGE PEND].REASON,
[MD IMPORT PURGE PEND].PLAN,
[MD IMPORT PURGE PEND].PAR,
[MD IMPORT PURGE PEND].IND,
[MD IMPORT PURGE PEND].REC,
[MD IMPORT PURGE PEND].SUBNO,
[MD IMPORT PURGE PEND].CLIENT,
[MD IMPORT PURGE PEND].CLAIM,
[MD IMPORT PURGE PEND].FSDT,
[MD IMPORT PURGE PEND].PDDT,
[MD IMPORT PURGE PEND].CHECK,
[MD IMPORT PURGE PEND].PROV,
[MD IMPORT PURGE PEND].SOURCE,
[MD IMPORT PURGE PEND].PAYEE,
[MD IMPORT PURGE PEND].EFF2,
[MD IMPORT PURGE PEND].CSHRCNO,
([CARR] & [CARR1] & [CARR2]) AS CPL,
[MD IMPORT PURGE PEND].CLASS,
[MD IMPORT PURGE PEND].MKTSEG,
[MD IMPORT PURGE PEND].PAID
FROM [MD IMPORT PURGE PEND]
WHERE ((([MD IMPORT PURGE PEND].SEG)="CONTROL") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOMES" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].SOURCE)<>"IN" And ([MD IMPORT PURGE PEND].SOURCE)<>"IP") AND
(([MD IMPORT PURGE PEND].PAYEE)="J" Or ([MD IMPORT PURGE PEND].PAYEE)="N")) OR
((([MD IMPORT PURGE PEND].SEG)="CONTROL") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOMES" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M")) OR
((([MD IMPORT PURGE PEND].SEG)="CONTROL") AND
(([MD IMPORT PURGE PEND].REASON)="35") AND
(([MD IMPORT PURGE PEND].IND)="HOMES" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].EFF2)="3")) OR
((([MD IMPORT PURGE PEND].SEG)="NASCO-NASCO") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOSTP" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].SOURCE)<>"IN" And ([MD IMPORT PURGE PEND].SOURCE)<>"IP") AND
(([MD IMPORT PURGE PEND].PAYEE)="J" Or ([MD IMPORT PURGE PEND].PAYEE)="N")) OR
((([MD IMPORT PURGE PEND].SEG)="NASCO-NASCO") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOSTP" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M")) OR
((([MD IMPORT PURGE PEND].SEG)="NASCO-NASCO") AND
(([MD IMPORT PURGE PEND].REASON)="35") AND
(([MD IMPORT PURGE PEND].IND)="HOSTP" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].EFF2)="3")) OR
((([MD IMPORT PURGE PEND].SEG)="PAR") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)<>"HOSTS") AND
(([MD IMPORT PURGE PEND].SOURCE)<>"IN" And ([MD IMPORT PURGE PEND].SOURCE)<>"IP") AND
(([MD IMPORT PURGE PEND].PAYEE)="J" Or ([MD IMPORT PURGE PEND].PAYEE)="N")) OR
((([MD IMPORT PURGE PEND].SEG)="PAR") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)<>"HOSTS") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M")) OR
((([MD IMPORT PURGE PEND].SEG)="PAR") AND
(([MD IMPORT PURGE PEND].REASON)="35") AND
(([MD IMPORT PURGE PEND].IND)<>"HOSTS") AND
(([MD IMPORT PURGE PEND].EFF2)="3")) OR
((([MD IMPORT PURGE PEND].REASON)<>"35" And ([MD IMPORT PURGE PEND].REASON)<>"44" And ([MD IMPORT PURGE PEND].REASON)<>"51") AND
(([MD IMPORT PURGE PEND].IND)="HOMES") AND
(([MD IMPORT PURGE PEND].CHECK)="000000000") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M") AND
(([MD IMPORT PURGE PEND].EFF2)="3") AND
(([MD IMPORT PURGE PEND].CSHRCNO) Is Null));
The part in bold is the exclusion. I want it to exclude records where the reason is 35 or 44 or 51, IND is HOMES, check number is 000000000, payee is s or m, eff2 is 3 AND cshrcno is null.
Can anyone tell me how to achieve this? I really appreciate your help!
View 4 Replies
View Related
Sep 27, 2005
Hello, I'm new to the forum and relatively new to Access. There's something I'm trying to do but I'm not sure if it's even possible so I'm hoping someone can help me out and point me in the right direction
the situation:
I have one very big table containing data for around 250 petrol stations. The data is collected monthly, so each site has a record relating to each month. E.g site A has data for month 1, 2, 3 etc.
The problem is that in any month, some of this data needs to be excluded from analysis. And this will vary over the months. What I want to do is run a query where specific records are excluded, for example, exclude Site A data for month 1 and 3, Site B data for month 2 etc.
I have another table containing a list of which site + month data is bad and to be excluded. Ideally I want to simply add to the list each month before I run the select query.
the question:
Is there any way to exclude records from a select query based on their details appearing on another table?
help would be much appreciated!
thanks
Catherine
View 2 Replies
View Related
Nov 14, 2007
Dear Friends,
I have one query based on code, rate, quantity. I created field for total (rate x quantity). What expression i can write that the query will calculate total only with the first figure as per code and if code repeats again, should not calculation total.
Please see the following query structure. Thats how i want my total to be calculated.
Code, Rate, Quantity, total
50,100,10,1000
50,100,10
60,200,20,4000
60,200,20
60,200,20
70,200,30,6000
Thanks
mithan
View 7 Replies
View Related
Oct 9, 2006
I have one table that will consists of about 1,000 rows. I have another table that consists of product codes that we want to exclude from the report. I know how to include the two tables by joining, but I want to EXCLUDE the 2nd table of product codes. Basically, if any of the product codes listed on table 2 are on table 1, I don't want them to appear. So how can I do an exclude function in a query?
View 3 Replies
View Related
Feb 14, 2008
Is there a way that in a query from several tables you can choose to exclude duplicates of a specific field?
In the query I'm trying to create I am going through and counting the number of customers in a certain time frame. I don't want to count a customer each time they buy something though, I only want to count them once. The dates of their purchases are held in a seperate table for purchases and the customer information is held in a customer table. The information I need is in both of these tables and each customer has an ID number which is how the two tables are joined.
When I tried using the DISTINCT code it still brought in all the purchases because the customer bought things on different dates. The only way I have ever used this, however, is to write SELECT DISTINCT at the beginning of the SQL instead of just SELECT. If there's another way to use it to do what I need I will try it as long as you tell me what it is.
How can I set up the query to bring in all the information I need but not duplicate the ID numbers?
Thanks in advance for any help I get!!!
View 3 Replies
View Related
Jul 1, 2005
Hello,
I have 2 tables.
1) Table A, which is a table of all 100,000 users
2) Table B, which is a table of all other users
I have a query qryA, which looks for everyone in table A with a certain type of job title.
I want to exclude anyone who works for a company that occurs in the table B from showing up in the qryA query.
Any ideas?
View 2 Replies
View Related
Nov 9, 2005
Hi all,
I have a table with some records:
Name, Date (Day/Month/Year)
John, 09/09/2005
Phil, 10/09/2005
Xena, 03/11/2004
I want my query to display all records with today's date, or those that are 100 days older than today's date.
I have the following so far (in my query criteria box):
Date() Or <Date()-100
BUT this shows me Xena's record, which is more than 100 days old (it's 2004)
Any help/corrections are welcome
Thanks
View 5 Replies
View Related
Mar 10, 2006
Hi All,
Say you've got 2 tables and you want to extract data from table 1 but exclude all records from table 1 which have a field value existing in table 2?
Table 1 fields:
Test_Code
Test_Desc
Table 2 fields:
Test_Code
Therefore, I would like to query out from Table 1 all Test_Code values which do not exist in Table 2. Any ideas please?
View 2 Replies
View Related
Apr 29, 2006
I created a report where is lists sales volume by day. I was asked to create a table where data can be excluded from this report. The exclusion table consists of only three fields:
Date Department and a check box
What do I need to do in the query to have it exclude the data listed in this exclusion table. The table only holds data we want excluded, not all dates and departments.
I originally added the table to the source query and made the criteria "False" for the check box but when the query runs it does return any data at all.
Please help!
View 1 Replies
View Related
Jun 8, 2006
Hi all, I know this is a real easy one, but I am not the smartest when it comes to access. Can you help me out.
I am running a crosstab query to count and sum records in my database. I have a fied called "Amount". In my form the user is not always required to enter an amount. When I run the query, I would like the results to exclude the records that have a null value or $0.00 in the "Amount" field.
How do I format the query to exclude those records?
Thanks in advance.
View 3 Replies
View Related
Jan 10, 2008
Hello all,
I am a bit stuck in my query. I need to setup a Next Follow-up date based on the last follow-up date excluding weekends.
For example: Last Follow-up: 1/10/08.
Next follow-up should be 5 days after that. So it should be: 01/17/08.
I have a calculated field that calculates the number of days (Counting off weekends) but I can't seem to have the date setup correctly.
Thanks
View 7 Replies
View Related
Dec 2, 2004
What expression do i use to count the number of patientID when there are duplicates (ie patient has come back for more than one visit but I just want to know the number of patients who visited (not how many times))
Count([patientID]) doesn't exclude duplicates
View 3 Replies
View Related
Jun 14, 2006
Hi,
Got the following question.
I have got two tables with the following values
Table X with Field ULX:
XAUUSD
XAGUSD
CAD
AAD
Table Y with Field ULY
AUDUSD
XPT
XAU
XAG
XAUUSD
XAGUSD
Now I want to select the values from table X that correspond witht the values in Table Y for which I use the INNER JOIN operation, wich is working and gives me the results I am looking for.
But now I want to select the values from Table Y that do NOT correspond with the values in Table X, when I rewrite the INNER JOIN operation but now with the <> operator, my results still show the values XAUUSD and XAGUSD from table X.
This is my query:
Select distinct Y.ULY from Y
Inner join X on Y.ULY <> X.ULX ;
What am I doing wrong?
Thanks.
View 1 Replies
View Related
Oct 18, 2012
I've composed a table in Access 2010 that I want to use as an annex to a printed document. However, each time I try to print out a hard copy it includes the table title and the date of printing. How do I stop this?
View 2 Replies
View Related