Queries :: How To Show Row Values As Column Values
Mar 8, 2015
I have a table with following two columns
TechName Version
SQLServer 2000
SQLServer 2003
SQLServer 2005
SQLServer 2008
SQLServer 2008R2
Oracle 11G
MSOffice 2000
MSOffice 2003
MSOffice 2007
MSOffice 2010
How can i show this data as components eqch version for a techname to be one component order need not follow
TechName Component1 Component2 Component3 Component4 Component5
SqlServer 2000 2003 2005 2008 2008R2
Oralce 11G NULL NULL NULL NULL
MSOffice 2000 2003 2007 2010 NULL
View Replies
ADVERTISEMENT
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
Aug 14, 2013
I am having some trouble with a program that contains a query that is suppose to sum a bunch of market values that have the same ID and is from the same portfolio.
The problem I had at first was that some of these IDs and portfolios that should have been summed together had one called counterparty that had different values.
So the problem that occured was the following:
ID Portfolio CounterParty SumOfMarketValue
5224 SPAC Counterparty1 -55
5224 SPAC Counterparty2 -45
What I wanted
ID Portfolio SumOfMarketValue
5224 SPAC -100
So what I did was that I deleted that column, but I am guessing that the table somehow might save that they have this difference. How I can make them appear in the same sum?
View 3 Replies
View Related
Nov 26, 2013
Names Number1 Number2
Name1 1 2
Name1 2 1
Name1 3 -2
Name1 4 2
Name1 5 5
Name2 1 2
Name2 2 5
Name2 3 2
Name2 4 5
Name2 5 -1
...
For each Name, Number1 will always contain the values from 1 to 5. Number2 can vary, however.
I need constructing a query that, for each name, will look at the values in the Number2 column when Number1 is 1 or 2 and multiply them. So, the result I'm looking for is:
Name1 2
Name2 10
(Since 2 = 2 x 1 and 10 = 2 x 5)
I haven't had much look Googling (most search results involve multiplying two columns together, which isn't exactly what I'm after).
View 1 Replies
View Related
Jul 4, 2013
I use the output of a query (qryTally) to set as my values to a table (tblOrderCountDaily) which sets all the count of a product ordered during a cmdbutton was clicked. If cutoff wasnt clicked for that day, it would create a new field setting the field name as the date. Now, if i click again the the cutoff button, it would check again if the field exists, if yes, i would add the value to the previous value.
Code:
Private Sub CutOff_Click()
Dim db As DAO.Database
Dim tbl As DAO.Recordset
Dim strSQL As String
Dim CheckOut As String
[code]...
View 1 Replies
View Related
Dec 20, 2013
I have employee attendance in Excel i.e Emplpyee Number, Day1, Day2, Day3....Day31
I have a table in access that have columns Employee Number, Day1, Day2, Day3...Day31, Presents, Annual Leaves etc
Excel file data needs to be transferred in Access table but the number of Presents, Annual Leaves etc needs to be calculated in Access during transfer not in Excel.
Now due to limited knowledge I do not understand how to resolve this issue and how to start. How to calculate the number of Present and Leaves.
View 3 Replies
View Related
Mar 2, 2014
I have a table having fields start date and end date. I need to calculate difference in the dates and store the values in a new column in the same table. I am able to write the query for this but am clueless as to how to put in these values in a new column in the table.
View 2 Replies
View Related
May 7, 2014
I have a spreadsheet which contains data exported from another system (which I have no control over). I'm using this spreadsheet as a linked table in my database.
The problem I am having is that I can't guarantee that when the spreadsheet is updated, it will contain the same column headings as it did the last time...
The spreadsheet contains a list of temps, with a summary of info off their submitted timesheets. So the column headings (as well as WorkerName, TimesheetDate, etc) may be "Standard Hour", "Overtime Hour", "Over 12 hrs Hour", "Standard Day", "Overtime Day", etc - for each type there will be a Pay Rate and a number of units (hours or days) claimed. The columns only appear if 'someone' in the spreadsheet has claimed something under that heading this week.
What I need to do is to produce a report which gives a summary by person and week of the number of hours claimed and the total charge. I've done that - that part was easy The part I'm struggling with, is how to take the column headings and turn those into descriptors for each charge type... in otherwords, to go from the sample 'timesheet' below to the sample 'ByType' ?
... when I don't know which columns will be present each week?
At the moment I'm using a union query to pull out the info I need, but if the column headings change then I know it will stop working...
sample of my union query... I currently have 8 different sets of bill rate and charge rate, this just does the first couple...
Code:
SELECT qryTimesheetBaseData.[Time Sheet Start Date], qryTimesheetBaseData.[Time Sheet End Date], qryTimesheetBaseData.[Cost Centre], qryTimesheetBaseData.Worker, "Standard" AS RateType, "Hourly" AS RateCategory, qryTimesheetBaseData.[Bill Rate (ST/Hr)] AS Rate, qryTimesheetBaseData.[Time Sheet Billable Hours (ST/Hr)] AS Billable, qryTimesheetBaseData.[Time sheet Status] AS Status
[Code] ....
View 3 Replies
View Related
May 17, 2013
I have duplicate data in a cell, I want to hide duplicate data and display only non-duplicate data.. I changed the property sheet to only show unique values, but it keeps showing data I don't want to see...
View 3 Replies
View Related
Jul 11, 2013
I have a field called density which needs to be updated to show either 10, 20, 30, 40, 50,60, 70 or 80 depending on a number of variables, for example: If market location is 'hot' and unit type is 'house' and discounted is 'no' then show '10' in the density box.
or perhaps:
If market location is 'cold' and unit type is 'apartment' and discounted is 'no' then show '20' in the density box.
I have tried all sorts of expressions and queries but have really reached the limit of my know how and can't solve it. Is it even possible to do this in Access?
View 2 Replies
View Related
Oct 4, 2013
I have a table that has two columns "Nationality" and "Gender". I wanted to run a query that will Group the nationality and then split the gender column into two columns and after that it will count both gender columns for each nationality. When I posted this question in "Reports" section I got the suggestion to use the SELECT COUNT in SQL. It worked but only for nationality. I couldn't get it work for the Gender column. I searched alot and the only thing I got was the SQL function to split data from one column into two but that also didn't serve the purpose (check the link to see why: [URL]) At last, I went on to create a cross tab query. Selected Nationality as Row header, Gender as Column header and Customer ID as calculation point. And there I got the result I needed. The SQL Code looks like this:
Code:
TRANSFORM Count(Register.[Customer ID]) AS [CountOfCustomer ID]
SELECT Register.National, Count(Register.[Customer ID]) AS [Total Of Customer ID]
FROM Register
GROUP BY Register.National
PIVOT Register.P_Gender;
Crosstab query did the trick..
View 1 Replies
View Related
Oct 1, 2013
One Manifest can have many line items. One line item can only have 1 designation. Each manifest may have many line item with same designations.
For example:
Manifest #0001
Line Item 1: N
Line Item 2: H
Line Item 3: U
Line Item 4: N
Line Item 5: P
Line Item 6: H
Table set-up
CurrentCY
CurrentCYIDPK
WasteCategoryIDFK
LineItemInformation [Line Item 1, Line Item 2, etc]
ManifestDataIDFK
ManifestData
ManifestDataIDPK
ManifestNumber [0001]
WasteCategory
WasteCategoryIDPK
WasteCategory [H, N, U, etc]
I'd like to query the line items for each manifest so the end result has the manifest number (Manifest #0001) in a field and the designations (N, H, P, U) in fields on a report.
View 14 Replies
View Related
Oct 20, 2014
I am trying to get a combo box to only show unique values, but I can't get it to work properly - it still shows duplicates in the list.
The Row Source is set to
SELECT DISTINCT Areas.ID, Areas.Area FROM Areas ORDER BY Areas.Area;
And the combo is bound to column 2
View 12 Replies
View Related
Aug 29, 2014
I'm using Access 2010. I need to calculate a score based on values selected in a table by looking up corresponding values in other tables. I have a "Project" form to create new entries into the Project table (see Table 1). When I create a new project record, I will select values for the Payback and Need fields by selecting options from a list. The Payback list is pointed at Table 2 and the Need list is pointed at Table 3. In the below example, I created the "ABC" project and selected "1 year" for the Payback field and "Repair" for the Need field. Pretty simple.
Now that I have the "ABC" project loaded to my Project table, I'd like to create a report that will show a "score" for this project. The score should be calculated as follows: Payback Impact + Need Impact. In this example, the score should be 30 (Payback Impact of 20 + Need Impact of 10).
View 5 Replies
View Related
Sep 18, 2013
I have a query with an INNER JOIN and ORDER BY that is working great. Now, using the same JOIN, I need to update values in one table with the values in another. I thought it would be simple until I learned you can't do an ORDER BY with an UPDATE. Is there another way to achieve the same result? If you remove the 'ORDER BY', the statement below doesn't produce an error but the results are not correct:
UPDATE TableA INNER JOIN TableB ON (Left(TableA.CDN,6))=(TableB.CDN)
SET TableA.HCC = TableB.HCC
WHERE TableB.HCC Like '241*' AND TableB.BBB = 'X' AND TableA.CCC = "1234" AND TableA.HCC IS NOT NULL
ORDER BY TableB.HCC, TableA.CDN;
View 2 Replies
View Related
Jun 18, 2013
I'm trying to determine the SQL to return only those records in a table which have duplicate values in each of two fields, but different values in a third field. Here's an example:
Code:
AcctNum FoodType FoodClass
------- -------- ---------
A123 Apple Fruit
A123 Apple Fruit
A123 Grape Fruit
A456 Potato Vegetable
A456 Potato Perishable
A789 Carrot Vegetable
A001 Banana Fruit
For the above table, I'm trying to return records which have multiple entries for AcctNum + FoodType, but DIFFERENT values for FoodClass. So for the above table, the query would return:
Code:
AcctNum FoodType FoodClass
------- -------- ---------
A456 Potato Vegetable
A456 Potato Perishable
It returns these two records because there is more than one record with for the AcctNum + FoodType (i.e. 'A456' + 'Potato'), but DIFFERENT values for FoodClass (i.e. one record has 'Vegetable' while the other has 'Perishable').
View 5 Replies
View Related
Mar 2, 2015
I have two tables.descriptions I'd like to relate and use to find/replace in bulk.
[Checking].[Description] (with the source data)
[Rename].[NewDescription] (with the correct data)
I'd like the values in [Checking].[Description] to be replaced with the values in [Rename].[NewDescription], including those that are "Like".
Examples:
[Checking].[Description] = Geico 12345
[Rename].[NewDescription] = Geico
[Checking].[Description] = Geic
[Rename].[NewDescription] = Geico
View 4 Replies
View Related
Mar 5, 2007
Hi all,
In the organisation that I work for employees get paid every 2 weeks on a Saturday. So for this financial year the pay period end dates have been 08/07/2006, 22/07/2006, 05/08/2006 etc
I have a column in an Access table listing various dates. I want the next column to be
populated with the next pay period end date after that date.
So if DATE is 05/07/2006 I want PAY PERIOD END to be 08/07/2006
and if DATE is 09/07/2006 I want PAY PERIOD END to be 22/07/2006 etc
How do I do this?
Kind Regards,
Matthew
View 1 Replies
View Related
Dec 4, 2011
I have this table ("people") and an example of possible rows:
id(key) COL 1 COL2 department country name
1 xx yy KPP USA John
2 zz kk KPP USA John
3 ss ff TLL USA John
4 ww qq PPO Italy Marco
5 jj uu PPO Italy Marco
I have to count the number of distinct DEPARTMENT for each NAME; so, for John should be 2 (KPP and TLL) and for Marco 1 (PPO).
I have tryed in this way:
SELECT
COUNT(DISTINCT department) AS NumberOfDifferentDepartments
FROM people
GROUP BY name;
But Access says me there is a syntax error.
I'm working with MS Access 2002.
View 2 Replies
View Related
Aug 1, 2006
Hello!
I have problem designing query for table whitch have 4 columns(ID,Date,Name,Value). I have one record each day for station(Name).
Now I would like to get a difference between each day for a month. (See picture)
Thanks in advance!
View 2 Replies
View Related
Aug 2, 2006
In my form the default for a field is 0 and the format is currency. How do I get the field to show $0.00 when there is nothing in it?
View 1 Replies
View Related
Aug 25, 2006
I am trying to devise a way to display query results in a row instead of a column. The table on which the query is built has this structure:
Column1: Index (pkf)
Column2: Group (int)
Column3: Position (int)
Column3: ItemCode (txt)
When I do a select query, the data comes back like this:
Group Position ItemCode
11A
12B
13C
14D
15E
16F
Etc.
I want to arrange the data this way:
1ABCDE (Etc)
I keep thinking that a cross-tab query is the answer, but all I seem to be able to do is to get counts of Position 1, 2, 3 Etc.
I’m baffled. Does anyone have a suggestion?
Thanks,
Rick
View 4 Replies
View Related
Mar 3, 2005
I've been having trouble trying to figure out how i can add the values within one column. I have a field named Cost, under that field i have serveral rows of data. I would like access to add all the numbers under that "cost" field. Im not sure how this is done. Can anyone please help ???
thanks
EM
View 6 Replies
View Related
Mar 15, 2006
I have a table with numberous records with Values in a number of fields. In a report I am showing all these records but at the end I want to tally the values.
Whats the best way to do this?
I thought of placing a text box in the form that will run some code to calculated the total....
What kind of code would I use to accomplish this?
Is there an easier way?
View 2 Replies
View Related
Jan 9, 2006
I have searched similar posts to solve this, but havn't been able to make it work yet, so apologies if this sounds like an existing post.
On my form (frmContacts) I have a combo box (LstCompany) that lists companies. The default value is set to "N" (so this is the value when nothing is selected).
I have a query (qryContacts) that retrieves records of People and their Companies from a single table (tblContacts - this table includes the fields 'Person' and 'Company'. Some people have no company). I want this query to:
- When no company is selected in LstCompany: show all people (whether or not they have a company).
- When a company is selected in LstCompany: show records for that company.
I have added the following expression to my query:
Expr1: IIf(([Forms]![frmContacts]![LstCompany])="N",True,([Forms]![frmContacts]![LstCompany]))
Criteria = True
This works fine for showing all records, but the Expr1 field returns #Error if a Company is selected.
Any idea what I am doing wrong, or what will work?
View 4 Replies
View Related
Aug 1, 2014
How do I get the second filter to show all the values and allow me to check which ones I would like to select? I cant seem to recall how to do this. I remember having to do it a while back.
View 8 Replies
View Related