Skip to content

Query to get the Average of ONLY the first occurrences

I have 2 tables like these: Table Info Table A I need to take the first occurrence (occurrency_date ordered asc) of each Info and subtract from when the Info was created (created_date), after that take the average between them Something like this: I made many attempts but none were successful, how could I get…

Query nanoseconds from first entry

I have a data set keyed with a TestID and a datetime2 value where there are about 8000 entries per TestID, each is about 100 nanoseconds apart. I’d like to query all rows for a given data set (#40 in this partial example) and return the nanoseconds from the first record. Like this: I have a query to do …

How to perform Many to Many Relationship Filter Query

I want to perform a query in MySQL based on a filter. First of all, the two tables that will be used in the query are the following: Equipment: Field Type Id PK, Integer Name Varchar(50) Recipe: Field Type Id PK, Integer Name Varchar(50) The relationship between the two tables is Many-to-Many, so there is a p…

Why does the query not return any data?

I want to retract objects within the dates Here are all the objects: And here is the query: However, if I change the last date to ‘2020-10-10’ everything works Answer What is the data type of the column StartDateTime? If it’s datetime, your where clause needs to look like this