I have a query that is created in VBA and selects column information from two other tables and creates a new table with that information. Existing Query: Select Prem.longitude, Prem.latitude, …
How to print SQL statement in codeigniter model
I have a sql statement in my model, I then say My query always fails, how do I get php to print the exact sql statement being sent to my database? And display that on my php view, page Answer To display the query string: To display the query result: The Profiler Class will display benchmark results, queries y…
Extract date (yyyy/mm/dd) from a timestamp in PostgreSQL
I want to extract just the date part from a timestamp in PostgreSQL. I need it to be a postgresql DATE type so I can insert it into another table that expects a DATE value. For example, if I have …
Simple DateTime sql query
How do I query DateTime database field within a certain range? I am using SQL SERVER 2005 Error code below Note that I need to get rows within a certain time range. Example, 10 mins time range. Currently SQL return with Incorrect syntax near ’12’.” Answer You missed single quote sign: Also, …
Using a conditional UPDATE statement in SQL
I would like to have an UPDATE statement like this: SELECT * FROM Employee WHERE age = CASE WHEN (age < 20) THEN age=15 WHEN (age > 20) THEN age= 20 Is this not possible in SQL Server / …
SQL Query To Obtain Value that Occurs more than once
I need to query my database to show the records inside my table where lastname occurs more than three times. Example: in my Students Table, there are 3 people with Lastname ‘Smith’, 4 with ‘Johnson’, …
How to send multiple data fields via Ajax? [closed]
I’m stuck: I’m trying to submit a form using AJAX, but I can’t find a way to send multiple data fields via my AJAX call. $(document).ready(function() { $(“#btnSubmit”).click(function() { var …
Syntax of for-loop in SQL Server
What is the syntax of a for loop in TSQL?
When using MySQL’s FOR UPDATE locking, what is exactly locked?
This is not a full/correct MySQL query only pseudo-code: Select * from Notifications as n where n.date > (CurrentDate-10 days) limit by 1 FOR UPDATE http://dev.mysql.com/doc/refman/5.0/en/…
SQL Server 2008 – How to convert GMT(UTC) datetime to local datetime?
I have an insert proc that passes in GETDATE() as one of the values because each insert also stores when it was inserted. This is hosted on SQL Azure – which uses GMT. Now, when I am receiving messages, I have the GMT date stored for each of them in their timestamp columns, how do I convert this to the