Help With This Access Query
Jul 11, 2005
How can i find max date and close value corresponding to that date. The following query doesn't work as A.Close is not a part of aggregate function and using group by on A.Close gives undesired results.
SELECT MAX(A.Date), A.Close
FROM (tblSecurityDay A INNER JOIN tblSecurity B ON A.SecurityID = B.SecurityID)
INNER JOIN CompanyDetails C ON B.SecurityCode = C.CompanyCode AND B.CompanyKey = C.CompanyKey
WHERE C.CompanyCode = 'ABC' AND C.CompanyKey = 1
Thanks
View Replies
ADVERTISEMENT
Sep 18, 2007
Hello All,
I am working on a project that was started in access, but needs to be moved into an Access project so that It can be integrated with other forms. When I did this I realized that my database queries needed to be changed from Access to SQL code. for example instead of representing a date as #DATE# it needed to be represented as 'DATE'.
However I have one issue that I am having issues with.
I have a query that determines a few collumns by running information through a vb function and returning the result.
The issue is I do not know how to convert this code from Access to SQL so that it will work.
The code is
SELECT Action_Indef([DUE],IIf(IsNull([WAIVER]),[DUE],[WAIVER]),[LOG_NO]) AS [Action], TESTSTAT.*, Action_date([DUE],IIf(IsNull([WAIVER]),[DUE],[WAIVER])) AS Action_Date_Field, IIf([DUE]<[WAIVER],[WAIVER],[DUE]) AS Later
FROM TESTSTAT
WHERE [LOG_NO] LIKE '*'
ORDER BY Action_Indef([DUE],IIf(IsNull([WAIVER]),[DUE],[WAIVER]),[LOG_NO]);
Can someone provide me with a sutible sql equvalent to this code
Thank You
Mike
View 7 Replies
View Related
Sep 18, 2007
Hello All,
I am working on a project that was started in access, but needs to be moved into an Access project so that It can be integrated with other forms. When I did this I realized that my database queries needed to be changed from Access to SQL code. for example instead of representing a date as #DATE# it needed to be represented as 'DATE'.
However I have one issue that I am having issues with.
I have a query that determines a few collumns by running information through a vb function and returning the result.
The issue is I do not know how to convert this code from Access to SQL so that it will work.
The code is
SELECT Action_Indef([DUE],IIf(IsNull([WAIVER]),[DUE],[WAIVER]),[LOG_NO]) AS [Action], TESTSTAT.*, Action_date([DUE],IIf(IsNull([WAIVER]),[DUE],[WAIVER])) AS Action_Date_Field, IIf([DUE]<[WAIVER],[WAIVER],[DUE]) AS Later
FROM TESTSTAT
WHERE [LOG_NO] LIKE '*'
ORDER BY Action_Indef([DUE],IIf(IsNull([WAIVER]),[DUE],[WAIVER]),[LOG_NO]);
Can someone provide me with a sutible sql equvalent to this code
Thank You
Mike
View 2 Replies
View Related
Dec 23, 2005
Can anyone help? I have a query that queries against 11 linked views against an SQL Server backend.
The query is running dog slow, so I want to convert it to a pass-through query so that the processing is done server side rather than Access having to drag thousands of records across the network, but don't know where to start.
The problem is that I need to convert the Access SQL to a version of SQL that SQL Server understands.
Is there a tool I can use that does this automatically (keeping my fingers crossed here)? If not then does anyone know where I can find out how to do this?
View 2 Replies
View Related
Apr 19, 2007
This is a Oracle query... its working in Oracle but didnt work in access...
select v.code_number,v.vehicle_number,v.company_code,r.fc _valid_to,
i.next_due_date
from (vehicledetails v left outer join rtodetails r
on v.code_number=r.code_number AND v.code_number='SMR5'
left outer join insurancedetails i
on v.code_number=i.code_number);
I need equalent Access query for this.... anyone plz help....
View 5 Replies
View Related
Mar 12, 2007
I have made this query in ms sql it works fine as per my needs iam getting the values but this doesn work in ms access 2002 can someone work this out its lil urgent tested out a lot of things but better to give the best people's n get their knowledge...
SELECT wc.windowsname FROM windowsconductivity as wc join constructiondetailes as cd on wc.windowsid=cd.materialid join uvalueconstruction as uc on uc.constructionid=cd.constructionid join projectmasterwindows as pmw on pmw.windowconstruction=uc.constructionname WHERE pmw.projectname='new8thmarch07' and pmw.windowconstruction='new8thmarch' and uc.constructiontype='windows' order by cd.constructiondetailsid
thanks aton...
View 7 Replies
View Related
Aug 8, 2006
Is it possible to run a query that's inside an Access database from another program? Possibly excel.
I continue to run into walls with the fact that I can't get my company to buy licenses for Access to put on PCs. I'm determined to work around these issues, but there are obvious limitations.
Right now I got Excel sheets linked to a database where it pulls information of a main database that I'll update. They hit a macro button and it fills their sheet with the information I've provided in the database. At the end of each shift, I pull the information back into the database with the updated numbers for the day with a Union Query, then collect all the data into a new table.
The "old" way was cutting and pasting data from 60 Excel sheets every day which took 2 1/2 hours. I accomplish it now in about 10 seconds. Enough patting on the back.
The problem is that I need to delegate some of this out because I simply don't work all three shifts that we have and I want someone to "pull" the data after each shift. Of course, the people that I want to do this do not have Access.
How can I enable them to run these queries? Is it even possible?
Am I missing another way to do things?
Thanks in advance...
View 10 Replies
View Related
Dec 9, 2006
Hi guys im trying to create a access database which has two colums like the example shown below.
Registry total registry
/// 3
basically the first colume would contain these symbols /// and i want the second colume to read off the first colume soo if I have /// the total registry colum would show the total number of ///.
how woud i get the tables within access to do this:confused:
View 8 Replies
View Related
Oct 9, 2007
Hi,I am new to database work.I have to write a query to design a report basaed on the data coming from raw table.I have a table which contains sales information like deal name,code,closing date of deal,total revenue for the year and probability.I have to write a query to get the new data based on the table containing raw data.
My query should contain monthly revenue and quarterly revenue based on the fields closing date and total revenue.ex:If the closing date for a particular deal is mar-08 then the total revenue entered in revenue field should get updated in a new field [march month].Please help me how to build a logic for the query.I have to design a report based on this information and source should be one table.
Any help would be appreciated...
pls help me thanks in advance...
below table givesidea to build a query:
Closing date Jan Feb Mar Apr May Jun Revenue Q1 Q2 Q3 Q4
Mar-08 1,500 1,500 1,500 0 0 0
Jun-08 4,000 4,000 0 4,000 0 0
Dec-08 6,000 6,000 0 4,500 0 6,000
.............................
..............................
Regards,
Sam
View 2 Replies
View Related
Feb 6, 2006
Hi,
I have recently started working on a Access database and I have very little knowledge about it. This is what I am trying to do: I made a form with 4 text boxes on it. The user fill sout the info in these text boxes and then hit a button. What i want to happen is:
One of the fields is actually a criteria for a query. Depending on what the field entry is, I want to make a report will all the records that match the criteria. eg: if the user types in 278 for a lot # criteria (one of the boxes on the form) then, i want all records that match that lot # to appear in a report.
I really have been struggling with this. Please help. Thanks ~svn
View 1 Replies
View Related
Feb 6, 2006
Hi,
I have recently started working on a Access database and I have very little knowledge about it. This is what I am trying to do: I made a form with 4 text boxes on it. The user fill sout the info in these text boxes and then hit a button. What i want to happen is:
One of the fields is actually a criteria for a query. Depending on what the field entry is, I want to make a report will all the records that match the criteria. eg: if the user types in 278 for a lot # criteria (one of the boxes on the form) then, i want all records that match that lot # to appear in a report.
I really have been struggling with this. Please help. Thanks ~svn
View 2 Replies
View Related
Feb 15, 2006
Im importing a file into access and i want to add querys. The problem is the field im querying wont always be in the same place or be the same name. The only thing that remains the same is that the field i want to query will always be the last column. Anyone know what to do for this??
Thanks
Marley.
View 1 Replies
View Related
Apr 14, 2006
Hello
I want to pass a parameter to this query determining how many records to select
parameter to replace the (Top 10 )
Select Top 10 * from customers
order by id
any idea will be appreciated
Thanks
View 1 Replies
View Related
Apr 20, 2006
Hi
i was hoping someone can help me with this, i am using access 97, i have a table from which i am trying to generate a query , basically what i want to do is for the query to show stock that is less than or equal to a percentage of a field called prefered stock, for example, if say my prefered stock level is say 200 units, when i run the query i want it to show all products whose stock levels are less than or equal to 40 percent of the prefered level, enabling me to see what needs to be ordered , however i do not know what criteria to add into the query to do this or how its done , say my field name is prefered_level and i want to show all products that are 40% of prefered level do you knwo how i would phrase this in the criteria or can access handle such a calcualtion, any help is much appreciated
thanks
j
View 2 Replies
View Related
Jun 15, 2006
Can someone show me how to convert this SQL query to an ACCESS query? - I have tried several time with no luck. Thanks! Mike
Select COUNT (b.case_id),
sum(a.amt_to_distribute) Held_amt,
iv_d_do_code,
cd_reason_status From vrcth a, vcase b
Where A.Cd_Status_Receipt = 'H'
And A.Dt_Distribute = '01-JAN-0001'
And A.Dt_End_Validity = '31-DEC-9999'
AND Not Exists (Select 1 from vrcth k
where a.dt_batch = k.dt_batch
ANd a.no_batch = k.no_batch
And a.cd_source_batch = k.cd_source_batch
And a.seq_receipt = k.seq_receipt
And k.ind_backout = 'Y'
And k.dt_end_validity = '31-DEC-9999')
And ((trim(A.Id_Case) IS NOT NULL AND A.Id_case = b.case_id )
Or
( trim(A.Id_Case) IS NULL
ANd b.case_id = (Select Min(y.case_id) from vcase Y, vcmem Z
Where A.Id_Payor = z.member_id
And z.relation_code IN ('A','P')
And z.case_id = y.case_id )
))
group by iv_d_do_code,
cd_reason_status
order by iv_d_do_code;
View 1 Replies
View Related
Apr 13, 2007
I have patients with temperature readings every minute. Some last an hour some last multiple hours, some last days. There could be 100, 500, or thousands of values.
I need to find the 10th value and 10 values before the end of the value list.
So if someone had 60 temperature readings, I need the 10th and the 50th.
Is this possible or do I need more tools?
If so do you have any examples?
View 11 Replies
View Related
Oct 9, 2007
Hi,I am new to database work.I have to write a query to design a report basaed on the data coming from raw table.I have a table which contains sales information like deal name,code,closing date of deal,total revenue for the year and probability.I have to write a query to get the new data based on the table containing raw data.
My query should contain monthly revenue and quarterly revenue based on the fields closing date and total revenue.ex:If the closing date for a particular deal is mar-08 then the total revenue entered in revenue field should get updated in a new field [march month].Please help me how to build a logic for the query.I have to design a report based on this information and source should be one table.
Any help would be appreciated...
pls help me thanks in advance...
below table givesidea to build a query:
Closing date Jan Feb Mar Apr May Jun Revenue Q1 Q2 Q3 Q4
Mar-08 1,500 1,500 1,500 0 0 0
Jun-08 4,000 4,000 0 4,000 0 0
Dec-08 6,000 6,000 0 4,500 0 6,000
.............................
..............................
Regards,
Sam
View 2 Replies
View Related
Dec 28, 2007
Hi,
I'm currently designing a car park system which charges the customer for parking.
In access using quries i'm trying to calculate the total number of hours parked.
Also how do I produce a monthly bill for the hours parked in the car park?
If you can help me I would be grateful.
Sam
View 1 Replies
View Related
Mar 17, 2008
=Last([PPM Month])-DateAdd("m",-6,Last([PPM Month]))
is the line I have, but what I really want is the difference in the field NEXT to the corresponding dates (the actual PPM)
How do I do that?
This is SQL in Access 2007
View 1 Replies
View Related
Jan 17, 2006
I have an Excel Spreadsheet.
This spreadsheet has 10 or so worksheets.
Duplicates are ok within each worksheet.
I need to find duplicates BETWEEN Worksheets.
I am concerned with TWO fields.
I can import this into Access as One table and find dups for Two fields, but I loose the seperation created by the worksheets (dups ok within worksheets)
I was thinking of importing the worsheets into Access and running my querys there.
Does anyone have an idea how to write a query that will look for duplicates between tables, all the while ignoring duplicates from within a table. Note this has to look at two fields...(file size and date)
I thought of doing something like this:
Import worksheets into seperate tables.
And a Field ("CLASS") in each table and assign a number to all the records
Write a query that looks for Duplicate
"File Size" And "Date" and NOT "CLASS"
Does that make sense....where File Size and date must match but Class must be different...
Any suggestions...I have never written a query that crosses between tables, search for dups, but allow dups in the existing tables....
IN DESPERATE NEED OF HELP
Thanks in advance
View 4 Replies
View Related
Feb 22, 2006
I am self taught in building databases and queries. I am puzzled about how to write a query to get the results my boss wants. Database contains a single table with these fields: PrinterSharedName, IP address, Office Location, Manufacturer, Serial#'s, etc
Problem is Ip Address field does not all contain IP addresses, as some of the printers are personal printers, not network printers.
I need a query to only report IP addresses that are in DB, along with PrinterSharedName and Office Location. Leave out printers that contain a NULL value in IP address field.
View 10 Replies
View Related
Nov 30, 2006
Hi,
I am having difficulty executing the following query in MS Access. I have 2 Tables:
1. Balances
2. Missing Fiduciaries.
I need to extract the 'Balance' from the Balances table based on the Plan Number in the Named Fiduciaries Table being equal to the Plan Number in the Balances Table. Does anyone have an idea of the approach I should take -??
Thanks
Deemack2006
View 4 Replies
View Related
Oct 9, 2007
Hi,I am new to database work.I have to write a query to design a report basaed on the data coming from raw table.I have a table which contains sales information like deal name,code,closing date of deal,total revenue for the year and probability.I have to write a query to get the new data based on the table containing raw data.
My query should contain monthly revenue and quarterly revenue based on the fields closing date and total revenue.ex:If the closing date for a particular deal is mar-08 then the total revenue entered in revenue field should get updated in a new field [march month].Please help me how to build a logic for the query.I have to design a report based on this information and source should be one table.
Any help would be appreciated...
pls help me thanks in advance...
below table givesidea to build a query:
Closing date Jan Feb Mar Apr May Jun Revenue Q1 Q2 Q3 Q4
Mar-08 1,500 1,500 1,500 0 0 0
Jun-08 4,000 4,000 0 4,000 0 0
Dec-08 6,000 6,000 0 4,500 0 6,000
.............................
..............................
Regards,
Sam
View 2 Replies
View Related
Oct 3, 2005
I have made a one table database and use a form for data entry into
that database. I have made a simple search form for searching by some
important fields and use the following like criteria in query designer.
Like [Forms]![queryform].[qname] & "*"
Here query form is the name given to the search form and qname is the
name given to the Name field. Similar criteria is given to rest of the
searchable fields. When I put any criteria like for example a name Ali
in the name search field and click search it gives me the database of
all records conatining Ali. But in other fields where there is more
longer text like memo boxes, which contains full sentences, in such
search boxes even if it contains the words like counseled, referred and I
type these words in their respective search boxes, running the query
doesnt return any results. It only yeilds results if I type the very
first word written in these memo boxes but searching for the rest of
the words doesnt yield any result.
So how can I correct this by writing proper SQL language for such
purposes.
View 2 Replies
View Related
Dec 22, 2005
I was wondering if anyone knows of a routine/standalone application that you can run to ascertain determine the usage (what forms/modules use them), of queries in an Access database - also, it would tell you whether certain queries listed, are not used at all and therefore can be removed if desired.....
I am keen to see if I can reduce the no. queries in my database as part of general housekeeping.
View 3 Replies
View Related
Jun 8, 2005
Here is a program that queries an Access database using a SQL Query Analyzer like program
Very cool indeed.
Hooks
View 6 Replies
View Related