Im new to using laravel and i have to query using the an sql string but the code fails to run because there is an error in the sql query The code is: $current_lat = $request->latitude; $…
oracle query for merge to row into one
I have a table with which showing in_time and out_time with gate number at separate row, but I wanted to show up this in one row, so I need to merge both rows into one here is result for this | …
Create New SQL Column With Smaller Buckets (Based on Text, not Numbers)
I have a column in SQL that has multiple “Definitions” but I would like anything that starts with DEF to just be the generic “Definition”. What can I put in my Select statement to have this converted? Answer You can use case:
Query table with compound primary keys
I’m using pyodbc to connect to a machine database, and query a number of tables in that database using pandas.read_sql(tbl,cnxn), where tbl = “SELECT * FROM TABLE”, cnxn is pyodbc.connect(‘DSN=DATASOURCE;UID=USERID;PWD=PASSWORD’). It works on most tables, but some tables return: …
insert values from one column to another in same table – SQL [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 2 years ago. Improve this question I want to insert values into new column from existing column in sam…
How to create a stored procedure to copy data from a query to a temporary table?
I have need of inserting data to a temporary table from an existing table/query. The following produces the error detailed below. Throws this error: Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword ‘begin’. Answer Correct your syntax, use procedure instead of table : However, i…
Order a MySQL query by fastest response time
I have a SQL query: SELECT number, ResponseTime, TicketCreateTime, round(time_to_sec(timediff(ResponseTime, TicketCreateTime))/60,2) AS FRMins FROM (SELECT TE.id, T.number, T.ticket_id, TE….
How to select rows using only number previous loaded rows?
I got a table with some rows For example: Them i load a half of rows After that i need to load all other rows, but all what i know about previous operation is that i load only 2 rows So i got only the number of already loaded rows = 2 So know i got a number or rows
Cannot figure out the issue with this SQL CASE
The issue i am facing is: “SYNTAX_ERROR: line 7:6: All CASE results must be the same type: boolean” I have also joined the table in a previous sub query casting it as a varchar, so there shouldn’t be any issues with this. Anyone have any ideas? For context i am trying to populate a field tha…
Ruby on Rails Database Query with Ruby Variable
This is the current code for my query.. I want to be able to add something like But everything I try doesn’t seem to work due to the “property_id” portion. I’ve tried concatenating, different assignments, etc. I feel dumb. SOS. Thank you ahead of time. Also, when I add.. Which “h…