Skip to content
Advertisement

Tag: mysql

Select updated rows in mysql

Is there simple way to select updated rows? I’m trying to store timestamp each time I am read row to be able to delete data that was not readed for a long time. First I tried execute SELECT query first and even found little bit slow but simple solution like but I still want to find a normal way to

Having trouble with WHERE DATEDIFF in my SQL

I think I’m going about this wrong. I want to pull the rows in my database that are less than a day old, in PHP. I’m using Laravel, but that’s not relevant. Here is what I have: However, that isn’t return the right results. It’s return results older than a day. Answer This query selects rows that are newer than

Get GPS data (lat, lon, address) for each truckId with the latest timedate

I have the following table : main(rowId, posDatetime, truckId, lat, lon, address) rowId: PK posDatetime: the date and time of the coordinates and address truckId lat,lon address: address string rows are not fed in datetime order. to get the latest position for each truck I hit the DB with this query FOR EACH truck: SELECT * FROM main WHERE truckId=XXXX

MySQL Error 1264: out of range value for column

As I SET cust_fax in a table in MySQL like this: and then I insert value like this: but then it say `error 1264` out of value for column And I want to know where the error is? My set? Or other? Any answer will be appreciated! Answer The value 3172978990 is greater than 2147483647 – the maximum value for

SELECT id HAVING maximum count of id

Have a products table with item_id and color_id. I’m trying to get the color_id with the most non-null instances. This fails: with This Returns I am looking for color_id 3, which has the most instances. Is there a quick and easy way of getting what I want without 2 queries? Answer This will give you the color_id and the count

Advertisement