sqlite> SELECT * FROM RawResponseTimes WHERE CreationTime <= 2011-06-14 17:17:23;
Error: near ":17": syntax error
Everything appears to be fine but it isn't happy with the hour 17, what gives?
Using SQLite.
Example - Less Than Operator You can use the < operator in SQL to test for an expression less than. In this example, the SELECT statement would return all rows from the products table where the product_id is less than 5. A product_id equal to 5 would not be included in the result set.
In SQL, the date value has DATE datatype which accepts date in 'yyyy-mm-dd' format. To compare two dates, we will declare two dates and compare them using the IF-ELSE statement. We can declare variables easily by using the keyword DECLARE before the variable name. By default, the local variable starts with @.
GETDATE() function: This function is used to return the present date and time of the database system. After comparison column contains the following string: Lesser than- If the date is less than today's date. Greater- If the date is greater than today's date.
Example - Greater Than Operator You can use the > operator in SQL Server to test for an expression greater than. SELECT * FROM employees WHERE employee_id > 3000; In this example, the SELECT statement would return all rows from the employees table where the employee_id is greater than 3000.
Looks like you are missing '
s from your date.
SELECT * FROM RawResponseTimes WHERE CreationTime <= '2011-06-14 17:17:23';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With