calculation for previous day - mysql

I have these four tables - Met_Work, Reference_work, Track_work and Ref_station. In my track_work table, the column names Created and completed are blank. I want to populate data into the created column in the track_work table using some columns from the three other tables.
I need to make a calculation that will populate data into the track_work "created column" based on how many orders were created in the previous day. The calculation should involve ("created from met_work", "station_name from ref_station", and "priority and work unit from reference_work".
I wrote a query below but it needs work -
SELECT created FROM MET_WORK
WHERE created count(if(DATEADD(day, -1, GETDATE())
SELECT TRACK_WORK.created, MET_WORK.created, REFERENCE_WORK.priority, REFERENCE_WORK.work_unit
JOIN MET_WORK ON MET_WORK.created = past_day.created
JOIN REFERENCE_WORK ON MET_WORK.priority = REFERENCE_WORK.priority AND MET_WORK.work_unit = REFERENCE_WORK.work_unit enter code here
enter code hereenter image description here
enter code hereenter image description here
enter code hereenter image description here
enter code hereenter image description here

Related

SSRS Matrix to Excel Export creates additional Row

I have Matrix table with "Indicator" in column Group and "NAME, ID and DATE" in Row Group.
DATE is toggled by NAME. it works fine when we view on browser. The problem comes when we export in Excel- it leaves an additional row. enter image description here
enter image description here -- here you go with the latest Screenshot

MS-Access - DLookup using values entered on form

I am a complete novice with no experience of building a database. I have been following a few online tutorials to help with a little project I want to work on.
Here is a pic of my current table relationships:
I have a form where I want to enter invoice details. I want to be able to select a product from a drop-down and for it to automatically populate a text box with the cost. The problem i have is, depending on the customer, the cost can be different.
Here is a pic of my form:
I have tried using DLookUp in the Unit Price field but i just can't seem to get the hang of it.
Basically, in pseudo code, i want the unit price field to:
Select From tblPrices Where PriceID =
I've tried:
=DLookUp([Product],"tblPrices","PriceID = " & [Forms]![tblInvoice]![SalesTypeID])
but it is returning the ID of the selected from product in the form from the Products table ?!

create a filter on multiple columns using a single dropdown list. ssrs

enter image description herei have a situation, i have a multi select drop down list. I would like to create a filter on multiple columns using a single dropdown list. eg :- Column A or Column B ( Search on column A value or Column B Value) how can i do it ?
REPLY
In the picture release is a multi select drop down list. and i want to filter on Future release as well as release columns that i display the data.
enter image description here
You can filter those two column at dataset level.
In query use "Where Release in (#ReleaseParamater) OR FutureRelease In (#ReleaseParamater)"
While passing parameter to dataset use join function to get value with comma separated like below.
JOIN(Parameters!ReleaseParamater.Value,",")
Check out below image
Filter Image
enter image description here

Displaying Total on MS Access Form

I need to develop quite a serious database in access and start building up the Main Menu.
So far I have (I have broken the problem down to a sample DB):
a) Set up a Table of Data (Table1) (Column 1 = Name, Column 2 = No of Staff (Numeric))
So my Data looks like this
Name No of Staff
TestName1 1
TestName2 2
b) Created a Query (Table1 Query) to provide a Total of 3 as a sum total - this works as I get a total of 3.
c) I created a Form that I want as my Summary Form.
and inserted a TextBox and placed the following formulae within the Expression Builder :
So I have the following :
But the Form field yields a #Name?
Sorry for the novice question but I have read up quite a lot about this and this should work fine. I am confused why this simple little task is daunting.
Any help would be great. thxs in advance
Two variants:
Set the query as datasource for your form and select the column with sum [Sum Of No of staff] as control source for your text field
set as Control Source for text field as
= Dlookup("[Sum Of No of staff]", "[Table1 Query]")

ms access: retrieving latest value

I have a table Project.
It has the following column: Project ID, projectName, UpdateTime
The data in the table is as follows:
Project ID projectName UpdateTime
1 abc 12-2-2009 01:10:00
1 abc 12-2-2009 04:18:00
2 xyz 17-7-2009 08:45:00
2 xyz 17-7-2009 12:21:00
i want the result set to display the latest update project information based on the update time.
for the above example , it should display
Project ID projectName UpdateTime
2 xyz 17-7-2009 12:21:00
1 abc 12-2-2009 04:18:00
This ought to do the job (as edited to reflect the information #Remou pointed out that I failed to note in your original question):
SELECT [Project ID], ProjectName, Max(UpdateTime)
FROM Project
GROUP BY [Project ID], ProjectName
ORDER BY Max(UpdateTime) DESC
If that doesn't do it, either I've made a mistake, or there's other information not included in your question.
SELECT P.[Project ID]
, P.projectName
, Max(P.UpdateTime) AS [Latest Update Time]
FROM Project AS P
GROUP BY P.[Project ID]
, P.projectName
ORDER BY Max(P.UpdateTime) DESC;
I have an answer which uses the graphical interface of a query which may be easy for you to implement. It is presumed that all 3 fields are contained in a single table. Create a new query by clicking "CREATE" and thereafter "Query Design". Right click in the upper section of the graphical interface that opens and click on "Show Table" Select the table that contains these three fields and double click on each field, one at a time so that it appears in the lower section. If you have an auto-number field please ensure that you do not include it in the lower section since this will cause all the table records to display. Any other additional field included in the query could have the same undesired result. Next, on your ribbon click "DESIGN" and after that click on the "Totals" icon. Focus attention on your "UpdateTime" field in the lower section. Change "Group By" to "Max" by clicking into that field and selecting from the drop-down list. To not make ay changes to the other two fields. Save the query and open it in Datasheet view (Do this by clicking "HOME", "View", "Datasheet View"
You should get the results you required. Please let me know whether this has now worked for you.
Ps. Spelling errors in the project name will also give you inaccurate results. To reduce the likelihood of this possible problem have your users to select project names from a combo-box that that has a drop-down list of project names. It is also possible to devise a means whereby the Project name is auto entered when a user selects a Project ID from a drop-down list.
I am not sure why everyone seems to want to group the projects. The question simply seems to ask to display the results in descending order of UpdateTime
SELECT * FROM Project
ORDER BY UpdateTime DESC
I also notice however, that in his example, the results that he anticipates has the records grouped by Project ID and Project Name, in which case the answer provided by #David-W-Fenton must be sufficient.
In Conclusion, he should have asked his question more clearly.