Queries :: Sum All Alternatives From Column That Equal Specified Value

Jun 27, 2014

I have a database with with 100s of values for a field. What I would like to be do is specify a value via a form and the query will return all options that equal the specified value.

so for example: Specified value = 150

Field 1 Field 2
------- -------

Name1 10
Name2 50
Name3 25
Name4 25
Name5 100
Name6 40
Name7 125
Name8 50

I'd like the query to return all possibilities that equal 150 so it should look like:

result 1 - name5 + name2
result 2 - Name5 + Name 8

View Replies


ADVERTISEMENT

Forms :: Value Of Text Box Is Equal With Column 1 From List Box

Nov 7, 2013

i create a project for salary company , i have a list box and have 6 columns & i have 1 textbox , i work with code and a listbox is the query know i need the value of textbox is equal with the column 1 from listbox how to do it ? like when i run form need to be enter the code when entered the code in listbox is equaled with the textbox .another question , in the list box i have one column it is about salary i want the total of salary.

View 4 Replies View Related

Queries :: Remove Duplicates - If 2 Fields Are Equal

Nov 19, 2013

I have a large table with many fields and many rows. There is no primary key. I'll call one field ParentPN, and another field ChildPN. There are many other fields as well. I want to identify all rows where BOTH the ParentPN and ChildPN occur more than once. I know how to create a query to identify duplicates of ONE field in the table, but not two. I can solve this with VBA: I will read the two fields of interest in the first row, then compare both values with every other row. If it finds another row with BOTH ParentPN and ChildPN identical with the first, that's a "hit". Then, repeat with all the other rows. I could find ways to make this run faster, but I was wondering if there are any build in functions to accomplish this. I looked at the Find Duplicates query builder, and all I see is I can select ONE field to search for dupes, not two.

View 14 Replies View Related

Queries :: Check If Date Is Equal To Last Day Of Month

Jun 9, 2015

I have two date columns in my table called "End date" and "Closing date".

An example could be 14-06-2015 and 13-04-2017.

I need to make a query which is checking if the two dates are equal to the last day of their respective month. I don't have two columns in the table with the last day of month, so I first need to find out what the last day in the month is.

View 2 Replies View Related

Queries :: Delete Query Where Code And Client Are Equal

Aug 8, 2013

I am trying to delete a record in tblinclude where record from tblexclude are equal to clientid and codeid

Here is the sql
DELETE tblinclude.ClientID
FROM tblexclude INNER JOIN tblinclude ON (tblexclude.ClientID = tblinclude.ClientID) AND (tblexclude.CodeID = tblinclude.CodeID)
WHERE (((tblinclude.ClientID)=1));

I get the error Specify the table containing the records you want to delete. I've searched for this but I am just not getting it today.

View 1 Replies View Related

Queries :: Count Of Records Equal To String In Different Field

Dec 24, 2013

I am looking to achieve a column within a query which gives me the count of records that are equal to a string in a different field, e.g.

Field1 Count
aaa21 3
aab01 2
aaa21 3
aaa21 3
aab01 2

View 2 Replies View Related

Queries :: Summary Of Columns In TSQL To Return -1 If Not Equal To 0

Sep 3, 2014

Is there an efficient way to return a -1/0 instead of some number/0?

A table has 4 outer joins to views that return a value or null depending on if that field represents a Federal lease.

These 4 outer joins work.

The result is a ID_Wells column and 4 columns with any combination of values or Null.

This line of TSQL:

ISNULL(ISNULL(dbo.vRE_FedLeaseType.Fed_Lease_Type, '')
+ ISNULL(dbo.vRE_FedLeaseMinOwn.MinOwn, '') + ISNULL(dbo.vRE_FedLeaseSurfOwn.SurfOwn, '') + ISNULL(dbo.vRE_FedDirHzLease.Expr1, ''), '') AS HasFedLease

This creates another final summary column [HasFedLease] that returns 0 or some number.

For the Rule Engine - 0 is False, any other number is True.

Access links to this SQL View. Is there a quick way with out a UDF to convert numbers > 0 to a -1?

Code:
SELECT dbo.Wells.ID_Wells, dbo.vRE_FedLeaseType.Fed_Lease_Type, dbo.vRE_FedLeaseMinOwn.MinOwn, dbo.vRE_FedLeaseSurfOwn.SurfOwn,
dbo.vRE_FedDirHzLease.Expr1 AS CountOffedLeaseDirHz, ISNULL(ISNULL(dbo.vRE_FedLeaseType.Fed_Lease_Type, '')

[Code] ......

View 3 Replies View Related

Alternatives To Now()

Jan 18, 2006

I have a query based around a persons sick start and return date. A report is based upon this and then this makes up a sub part of management information report that is linked through a formatted month. Part of my report is based around the following formula, this governs which MI report to include it in

repMonth: (IIf(IsNull([returndate]),Format(Now(),"mm/yy"),Format([returndate],"mm/yy")))

This states that if a person has not returned to work then give them a formatted version of now() so it can be linked to the main report. My problem is if i wanted to look at a previous months report and a person has still not returned to work they will have the now() date and thus not be included in a previous months report! Does this make sense, have i gone a really out of the way route to solve my problem and can anyone see a more effective way of carrying out this problem?
thanks in advance, sorry for confussion!

View 1 Replies View Related

SQL Alternatives? Please =)

Nov 6, 2006

Heya,

I was working on an sql problem and solved it:

SELECT planten.PLANTNAAM, planten.SOORT
FROM PLANTEN AS planten
WHERE (((planten.ART_CODE) Not In
(SELECT offertes.ART_CO FROM OFFERTES offertes, BESTELRG bestelrg, BESTEL bestel
WHERE offertes.ART_CO_LEV = bestelrg.ART_CO_LEV
AND bestel.Bestelnr=bestelrg.bestelnr
AND bestel.Lev_code=offertes.lev_code)));

However, I need find an alternative to NOT IN if one exists and isn't too long? if anybody can offer an alternative it would be appreciated :)

View 1 Replies View Related

Queries :: Criteria In Query Is Greater Than Or Equal To 15% But It Gave Values Less Than 15%

Nov 24, 2013

same as the title goes, why i can't query those figures greater than 15% only? How am i suppose to query them right?.Here is my database you cant check query1 and query 2. I am using Ms Access 2010.

Link:

www dot dropbox dot com/s/n3iuev1c5e0dfby/StockMonitoring.accdb

xD: StockMonitoring.zip

View 5 Replies View Related

Alternatives To GUID?

Jul 28, 2007

My company has satelite offices, which will be using database as well. For security and performance reasons, it is not feasible to have them connect to central server for a central back-end. (This may be different if we used a SQL backend, but migration takes time so that will need to wait).

My idea was I'd provide each satelite office their own local backend and have backend transmit the data to a central backend on a server which is fully replicated periodically while not in business. This would give the best balance between performance, security and network traffic.

But that creates the problem of possible conflicts between records' keys. I'm looking at GUID, and based on the amounts of records we usually do, I'm thinking GUID is a bit too excessive.

Maybe anyone can make suggestions if there's another way to prevent key conflict when the local backend and central backend synchronizes?

View 4 Replies View Related

How To Use IIF When More Than Two Alternatives Exist

Aug 24, 2006

Hi,
My database has 3 fields ID,Cust_Balance,Cust_Type.
I need to assign Cust_Type as 1,2,or 3 based on Cust_Balance amount.
If Cust_balance is lessthan 3 million then Cust_Type is 1,if between 3 and
10 million then type 2 and,more than 10 million as type 3.How do i accomplish this in Access ?Is IIf the right choice?:confused:

View 1 Replies View Related

Social Security Alternatives?

Jun 11, 2007

Hi,

I need a natural unique id for current and new enrollees, and I do not want to store social security numbers. If a new person enrolls, I need a way to know if they're already in our system.

I was wondering if a lookup table would work, where you switch a random autonumber for a social. If this will work, is it more secure than simply storing the socials?

Thank you!

View 2 Replies View Related

Queries :: Run A Simple Update Query To Copy Data From One Column To Another Column

Sep 24, 2013

I am trying to run a simple update query to copy data from one column (Addrl1)to another column (Working_Addrl1) within the same file and I can't for the life of me figure it out. Then I need to repeat for addrl2 and addrl3 to working_addrl2 and working_addrl3.

View 7 Replies View Related

Queries :: Change In Column Based On Base Query Column

Mar 24, 2014

I have created a cross tab to extract pipeline and sales for Q1 2014, Q2 2014, Q3 2014 & Q4 2014... the user can select the quater from a multivalued text box...

Now for the final output, have created another query which pull the above four quarter in each column from the cross tab...now the problem arises when i change the quarter to Q2 2014, Q3 2014, Q4 2014 & Q1 2014..it gives an error "Microsoft office Access database does not recognizes "Query name" as a valid field name or expression".

The error is because the second layer of query does not identifies Q1 2014.

How do i make access change the column automatically when the Q1 changes to Q2...

View 1 Replies View Related

Queries :: Find Unmatched Contents From The Column By Matching With Another Column?

Nov 16, 2013

i have a columns as 1. contactname, 2. firstname 3. lastname 4. email and in this columns some emails are not matching with the contactname or some time firstname or some time lastname so i need the to find out the un matched contacts from the database.

View 1 Replies View Related

Queries :: Add A Column In A Query That Will Give Y Or No To Previous Column

May 21, 2015

I am looking to add a column in a query that will give a Y or No to previous column data if it contains TEXT or NUMBER (It could read "TEXT" or "NUMBER" or even Y for text or N for number).

View 3 Replies View Related

Queries :: How To Distribute Different Values Of One Column In New Column Fields

Jan 30, 2014

In my table for duplicate "line no" I have different "contractor" like below.

LINE NO CONTRACTOR

L-0001 C-1000
L-0001 C-2000
L-0003 C-6000
L-0003 C-8000
L-0003 C-9000
L-0004 C-5000

Now I would like to make a query for transposing values like below:

LINE NO CONTRACTOR1 CONTRACTOR2 CONTRACTOR3

L-0001 C-1000 C-2000
L-0003 C-6000 C-8000 C-9000
L-0004 C-5000

how I have to make this query?

View 1 Replies View Related

"Not Equal And Not Equal" Query Not Working

Apr 14, 2006

I am trying to run a query where one field has a Not Equal parameter AND another field has Not Equal parameter (for example, Product Code Not Equal "A" AND Client State Not Equal "NY)

The result of the above query are all records that have Product Code = "A" are missing from the result. I want some of the "A" Product Codes; I just want to exclude the ones where the Client state is NY.

The list of values for each field is too big to state it in a positive way (I would have to list all the other 28 product codes and all the other 49 states).

What am I doing wrong? Thank you in advance for any suggestions.

View 1 Replies View Related

Queries :: Combine Two Queries Result Of Second Query In Another Column

Mar 15, 2014

i I have two queries.. What i'm hoping is to combine the result into one query but not in one column only but instead the result of the second query should be beside the first query.. The result of the second query should be added as a new column.

First Query

SELECT tbl_uSers.UserName, Count(tbl_rEceived_eMail.EntryID) AS eMailReceived
FROM tbl_rEceived_eMail INNER JOIN tbl_uSers ON tbl_rEceived_eMail.UseriD = tbl_uSers.UseriD
GROUP BY tbl_uSers.UserName;

Second Query

SELECT tbl_uSers.UserName, Count(tbl_rEceived_eMail.EntryID) AS eMailProcessed
FROM tbl_rEceived_eMail INNER JOIN tbl_uSers ON tbl_rEceived_eMail.UseriD = tbl_uSers.UseriD
GROUP BY tbl_uSers.UserName, tbl_rEceived_eMail.ProcessedYN
HAVING (((tbl_rEceived_eMail.ProcessedYN)="Y"));

View 2 Replies View Related

Queries :: 2 Queries Into A Single 2 Column Query?

Jun 6, 2013

I would like to be able to take 1 column from 2 different queries and put them into 2 columns in a 3rd query.

View 6 Replies View Related

Queries :: How To Retrieve Column Data Other Than Specified In 2 Sql Queries

Apr 14, 2014

I have a table (tbl1) contains sample records in Basecode column like S2378797 , R1165778 , W1165778 , N1165778

Description EID Basecode
----------- ---- ---------
ssdad 1001 S2378797
gfd 1002 S1164478
gfdsffsdf 1003 R1165778
ssdad 1004 M0007867
gfd 1005 N7765111

[code]....

And retrieving all **Basecode** if column data length >6 and with numbers '96', '78','54','15' by this query

Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1
WHERE (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));

How do i get other data which won't retrieve based on above queries, other than data mentioned on these queries like this

Description EID Basecode
----------- ---- ---------
ssdad 1001 2378797
gfd 1002 1164478
ddd 1004 1040
d88jg 1004 14C676
fsa 6565 158
fdh 1004 2Khlm
ggdg 2009 967

Third query not working

Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1
WHERE (IsNumeric(Left(Base,1)) AND Left(Base,1) Not In ("W","N"))
AND NOT (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));

View 2 Replies View Related

Queries :: How To Get Sum Of Multiple Queries In Each Column

Oct 1, 2014

How to write the syntax to get the sum of a query in a query builder. I want to get the sum of multiple queries in each column. ie (Query: R1-R7)

View 3 Replies View Related

Not Equal?

May 26, 2005

Hey,

I have 2 tables that i compere together with a query and if my criteria is OK than selected data is recordet in new table with some calculation....code:

INSERT INTO tblZaloga ( Proizvajalec, Tip, DN, Predvideno, Naroceno, Zaloga )
SELECT tblACAD_Urejeno.Proizvajalec, tblACAD_Urejeno.Tip, tblACAD_Urejeno.DN, tblACAD_Urejeno.KosovSkupaj, tblIN_Urejeno.KosovSkupaj, Sum(([tblIN_Urejeno].[KosovSkupaj]-[tblACAD_Urejeno].[KosovSkupaj])) AS Zaloga
FROM tblACAD_Urejeno, tblIN_Urejeno
WHERE (((tblACAD_Urejeno.Tip)=[tblIN_Urejeno].[tip]) AND ((tblACAD_Urejeno.DN)=[tblIN_Urejeno].[DN]))
GROUP BY tblACAD_Urejeno.Proizvajalec, tblACAD_Urejeno.Tip, tblACAD_Urejeno.DN, tblACAD_Urejeno.KosovSkupaj, tblIN_Urejeno.KosovSkupaj;


Now i have a problem with racords that does not reach my criteria. The problem is that i dont know witch records are the one that does not reach my criterya? Can someone pls tell me how can i create a table like the code up there but with records that are not procesed?

THX

View 2 Replies View Related

Not Equal?

Jun 8, 2005

Hey,

Can someone pls tell me how can get not equal resoults from my two tables? I have table1 and table2 both with field "Layer" and what I want is to get only that data from table1 that does not have the same Layer as table2.Layer?

I try to JOIN table1 and table2 and i get the same resoult as with this code:
WHERE ((tblACAD_MRK.Layer)=[tblLayerji].[NeteniLayer])

but thats exactly the oposite from what i want, so i try with this code:
WHERE ((Not (tblACAD_MRK.Layer)=[tblLayerji].[NeteniLayer]))

and the code does not give me the resoult that i want, becouse i get all the layers for some reason :confused:

So can someone pls tell me what can i do?

THX

View 2 Replies View Related

Not Equal

Sep 27, 2005

I'm wanting to write this query that looks at both tables and only returns records that don't match...not for sure how to do this..


SELECT tblCombined.DLID, tblCombined.DUP, tblCombined.QRYRAN
FROM Susp_Master INNER JOIN tblCombined ON (Susp_Master.DUP = tblCombined.DUP) AND (Susp_Master.DLID = tblCombined.DLID);

View 4 Replies View Related







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