Filter in products.list api - google-apis-explorer

Is there a way to filter the results from
GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products API.
eg: 1.expirationDate > somedate
2.last update date >somedate
Basically, I need to get products which get expired after a particular date and also products got updated after a particular date

Related

Adaptive SELECT statement dependent certain values being present

I am trying to build a SELECT statement on a MySQL view that will end up as a resource on a calendar app. Clients are booking out a piece of equipment for a period of time (bookings). Payment (payments) is taken at the beginning of the hire period for the equipment but further payments can be made if the hire period is extended. Therefore a single booking will have one, possibly many payments associated with it. Payments are recorded with the amount paid and the date they are paid.
Bookings for equipment must appear on the calendar if the date being viewed is within the hire period. Also, and this is the part I am having trouble with, payments, if they have been made on the date viewed, must be displayed (the reason for this is that my customer wants a daily total of takings for hires). If they haven't made a payment on the date viewed then the amount must appear as 0.
My view is built from three tables - bookings, payments and clients. The clients table is unimportant in this problem as it is just used in the view to generate the client name to be displayed on the calendar.
[![bookings][1]][1]
[![payments][2]][2]
The view is shown below
[![view_bookings_detail][3]][3]
This is what I am attempting to achieve. When the user opens the calendar or changes the calendar date, that date is used in my resource SELECT query as a parameter. In the first example we are viewing 04/07/2022. The parameter [selected_date] is set to '2022-07-04'. My initial SELECT statement was -
SELECT client_id, title, longterm_fee FROM view_bookings_detail WHERE start_date <= '[selected_date]' AND end_date >= '[selected_date]'
This returns -
[![calendar resource feed][4]][4]
Clearly this is no good as it would result in multiple entries for both hirer's. If I amend the select statement to -
SELECT client_id, title, longterm_fee FROM view_bookings_detail WHERE start_date <= '[selected_date]' AND end_date >= '[selected_date]' AND ltf_paid_on = '[selected_date]'
This returns -
[![amended calendar resource feed][5]][5]
This returns what I want but only because the two hirer's made payments on 04/07/2022.
If I were to view 05/07/2022, for instance, using the above logic, no records would be selected as no payments were made on 05/07/2022. What I would need returned in this case is a single record for each hirer with the longterm_fee showing as 0
I don't know how to achieve this. Anyone any ideas please?

Error when runing query from form between two date from a form

I have a form called FirstInLastOut which looks as the image below.
Based on Name or badge number I want to search between two dates.
I am using the following criteria on the query:
>=[Forms]![FirstInLastOut]![StartDateEntry] And <=[Forms]![FirstInLastOut]![EndDateEntry]
This is given me results that include other months as well. Please see the query report below.
So as you can see in the image the numbers of the dates are falling with the the parameter but getting other months as well.
How can I make it so it will only select the dates between the date ranges?
SELECT FistClockInRaw.Badgenumber, FistClockInRaw.name, FistClockInRaw.lastname, FistClockInRaw.MinOfCHECKTIME, FLastClockOutRaw.MaxOfCHECKTIME, [MaxOfCHECKTIME]-[MinOfCHECKTIME] AS TotalHours, FLastClockOutRaw.QDate, FistClockInRaw.MinOfQTime, FLastClockOutRaw.MaxOfQTime, RawCompleteQuery.CHECKTIME
FROM RawCompleteQuery, FLastClockOutRaw INNER JOIN FistClockInRaw ON (FLastClockOutRaw.Badgenumber = FistClockInRaw.Badgenumber) AND (FLastClockOutRaw.name = FistClockInRaw.name) AND (FLastClockOutRaw.QDate = FistClockInRaw.QDate)
WHERE (((FistClockInRaw.name)=[Forms]![FirstInLastOut]![FirstNameEntry]) AND ((RawCompleteQuery.CHECKTIME)>=[Forms]![FirstInLastOut]![StartDateEntry] And (RawCompleteQuery.CHECKTIME)<=[Forms]![FirstInLastOut]![EndDateEntry]));
is the Query
I assume that the forms fields StartDateEntry and EndDateEntry are bound to fields of type date.
I also assume that you are only interested to compare the date part of those form fields.
So try this condition instead to assure correct date interpreting:
WHERE FistClockInRaw.name=[Forms]![FirstInLastOut]![FirstNameEntry]
AND RawCompleteQuery.CHECKTIME >= Format([Forms]![FirstInLastOut]![StartDateEntry], "\#yyyy-mm-dd\#")
AND RawCompleteQuery.CHECKTIME <= Format([Forms]![FirstInLastOut]![EndDateEntry], "\#yyyy-mm-dd\#")
A remark:
Be aware that every date field/variable always contains a time part too!
So your current logic comparing EndDateEntry with <= can cause trouble, because you would only get results of the end date having time values of 00:00:00 in the field CHECKTIME.
If any record of CHECKTIME contains the requested end date and a time part bigger then 00:00:00, it is not in the result.
To avoid that, you should use < and add one day:
And RawCompleteQuery.CHECKTIME < Format([Forms]![FirstInLastOut]![EndDateEntry] + 1, "\#yyyy-mm-dd\#")

MySQL Date Handling Before a Given Date Table Join

I have two tables.
One contains information on a given reporting date and another has information on an incident date.
I’m trying to generate a list of the latest information before a given incident (i.e. if an incident occurred on 12/15/2015 and I have reports for 12/15/2014, 12/1/2015, and 1/12/2016, I want to pull the information for 12/1/2015 from that Data set. If on the second row there is another incident that occurred on 1/13/2016 and I have the same data as above I only want to return the information on 1/12/2016).
Dates are in a different column than ID.
Tables are in the following format
ID - DateV- ValueX
JAS 2017-12-15 00:00:00 3.45
I’ve tried running a query similar to below, but it only returns the first item ID-DateCombination not a list of all items. I would even be fine with just the latest reporting date by incident ID. That would give me enough to get the values I need.
Reporting Table - TableRep
Incident Table - TableInc
SELECT TableRep.ID, TableRep.DateV, TableRep.ValueX
FROM TableRep
INNER JOIN Table
ON TableInc.DateP > (
SELECT Max(TableRep.DateV) FROM TableRep;);
I’ve narrowed it down to only records before a given date in the table, but I’m struggling to lose the dates other than the latest ones.
Essentially, I would like to pull the id and Date from TableInc and the first date before the date indicated in TableInc from TableRep for each record in TableInc. Some IDs have multiple entries, so I can’t just pull them all and choose the max for each ID, that would only represent about 50% of the population.

In MS Access is it possible to automatically update data based on date criteria?

For example products have a release date and currently lookup the associated price category A, B or C from a second table - I am looking for a way to automatically change the price category based on the time since release.
Short answer: Yes. Long answer: Use an UPDATE query
UPDATE Products
SET CategoryID = 2
WHERE CategoryID = 1 AND ReleaseDate BETWEEN #2015/01/01# AND #2015/12/31#
I prefer to use the year first date format, as the position of days and months is always the same.
Since you don't give us much information on your table structures, this is only a guess.
You can also use the Access DateDiff and Date functions in order to calculate the time since release automatically.

MYSQL Query to retrieve current month data as well as check for last month

I have a table work_history('id','name','work','work_month','work_year').
I need a query to current current month data, but if data is not exist for current month, in this case retrieve last month data so on.....till then data not found.
nly
For Ex- If data found for 11-2012 so retrieve only this data, no need to check for previous month, but if not found so check for last month 10-2012. If again not found check 09-2012.
Thanks in advance
The month that you want is the maximum month that is available in the data. it must be either the current month or the closest to it. so such query should look like:
select ......
from work_history
where work_month = (select max(work_month) from work_history)
note that if the column work_month is a char column, you might need to convert the data to date type in order to allow correct comparison. based on the format seen in the example above:
select ......
from work_history
where str_to_date(work_month,'%m-%Y') = (select max(str_to_date(work_month,'%m-%Y')) from work_history)
EDIT
following all comments, the following query should fix the mistake I had and also give data based on ID of the user:
select wh.*
from work_history wh,
(select id, max(str_to_date(work_month,'%m-%Y')) as mx_month
from work_history
where str_to_date(work_month,'%m-%Y') <= curdate()
group by id
) wh2
where wh.id=wh2.id
and str_to_date(wh.work_month,'%m-%Y') = wh2.mx_month