to get date dynamically exceeding 24hrs - mysql

Iam writing a query by which i should get the contents from table which are not attended even after 24hrs of it is created .Can any one please tell me how to get the contents . Right now iam using
Created_time<'+DateTime.Now.addmin(-24)+'
But this is not working .Can any one please help me out
Thanks in advance for any answers

Use the date functionality in the database only, that will save you trouble in the long run. Use a query like:
SELECT * FROM table_of_interest WHERE datediff(curdate(), created_time) > 0
As for your original DateTime.Now.addmin(-24), I would expect that to be 24 minutes in the past, rather than 24 hours, but I don't know what language you're using so I might be wrong.

Related

MS Access; Remove Time stamp from Date\time field in all records

Is there another way besides running an Update QUery to take 1 particular Date\Time field in my main table to "mm/dd/yyyy hh:mm:ssPM" to just "mm/dd/yyyy"?
ive seen other answer's that involve querys or VBA but I didnt know if there was a secret access command for this type of change. If not I will run a query but im always eager to know short cuts!
You can use a select query to rip the time part:
Select *, Fix([YourDateTimeField]) As DateOnly From YourTable

Offsetting a graph by the first value of the shown time span - MySQL

I tried to add this as extension to Offsetting a graph by the first value of the shown time span, but it is not allowed.
So now the same question again here:
Can anybody help me to realize this solution:
SELECT cumulative_sum(difference(max("in-total"))) FROM "le.e6.haus.strom.zähler.hausstrom-solar" WHERE $timeFilter GROUP BY time($__interval) fill(previous)
in MySQL? Is that even possible? I have little to no experience with MySQL, I am mainly using it to write smart home data into it and use Grafana for output. But displaying energy consumption per selected time perioud eludes me by far.
Thanks, Matthias

How to select rows in google sheets by condition

I've been researching this for a couple of hours now and have had no luck.
I am trying to search for emails in my spreadsheet that contain "#google.com" and have them all selected so that I can copy them instead of going through them 1 by 1. There are around 90K so this would be a considerable undertaking.
This is the formula that I am currently using:
=QUERY(Data!A:A,"select A where(A =#google.com)")
All of the data is in column A.
Hope I've just made a dumb error somewhere.
Thanks in advance :)
Perhaps what you might try is:
=QUERY(Data!A:A,"where A contains '#google.com'")

MYSQL Time Comparison Range

I'm trying to help a taxi company. The problem is that they have a credit card machine that takes payments, and has its own database entries, and there is a completely separate database that has a list of entries such as pick up time, and drop off time.
I need to match the database of trip entries to the credit card purchases, and the only way to do this is by matching which vehicle is running the transaction, and looking for a time CLOSE TO the DROP OFF time and see if it's a match. It's not ideal.
So, I am trying to compare two times in yy-mm-dd hh:mm:ss format. They need to be plus or minus 5 minutes of each other. How do I do this in MYSQL?
I thought SubTime and Addtime would work, and it seemed to, but then I got wierd results.
SELECT * FROM completedtrans WHERE DrivID = 128 AND TransTime BETWEEN SUBTIME('2013-06-20 16:53:06', '0 00:05:00') AND ADDTIME('2013-06-20 16:53:06', '0 00:05:00')
Here's an example of one of my searches. Can anyone tell me what's wrong with it? It's supposed to search 5 minutes before and after that particular given time. I can't simply write the time, because the query is automatically generated through php code.

Similar rows in MySQL

I'm trying to select the top ten most similar properties for a given property in a realty site and I wondering if you guys could help me out. The variables I'm working with would be price(int), area(int), bathrooms(int), bedrooms(int), suites(int), parking(int). At the moment I'm thinking of ordering by ABS(a-b) but wouldn't that be slow if I had to calculate that every time a property is viewed? (I'm not sure I could cache this since the database is constantly being updated) Is there another option?
Thanks for your help!
One solution could be to create a new table containing the result ready. Like this:-
property_id similar_properties_ids
--------------------------------------
1 2,5,8
2 3,10
...
...
And a cron running at regular intervals doing the calculation for all the properties and filling up the similar_properties_ids.
So, at runtime, you don't have the calculation overhead but the downside is that you get results which are a little old (updated during the last cron run).