I’m using MS SQL Server 2019 I have a string in a table (tblJobCosts) that has its own ID like this: How do I update the value stored in the brackets based on the value from another table? The end result would look like this: I thought I could incorporate a SELECT with a REPLACE but this does not seem
Tag: select
How to make an dynamic SQL SELECT query by passing in a comma separated list of values?
I have a column in my SQL database (using mySQL) ‘lastname’, which has any number of employee’s last names in it. I want to write a query that handles a search for last names using a comma delimited list. So the user will type: And that gets stored in a String, lastNameQuery, which then gets passed into my backend API
How to wirte an select with forigin keys and such
I am about to setup a sql db, not decided yet for mysql, mariadb or postgresql. But before that I have set up my sql script to create the tables I need. First I need help with a sanity check, can you without me see what I am setting up here? Second, the thing I am struggeling with now is
How to combine two tables in Oracle SQL on a quantitative base
beacause of a really old db design I need some help. This might be quite simple I’m just not seeing the wood for the trees at the moment. TABLE A: ID 1 2 3 4 5 TABLE B: ID VALUE B 1 10 1 20 2 10 2 20 3 10 3 20 3 30 4 10 TABLE C: ID
How to separate everything inside my sqlite database
i have a database which has two thing in my database, name of a fruit and how long is it in the freezer. when i use rows will actually show the name of the fruit, time in freezer and the amount of fruit in batch How do i separate this, so that Or at least tell me how do i
How to access attached database’s tables using python’s sqlite3?
I am attempting to attach a second database to an sqlite3 connection to a database. However when I attempt to retrieve the tables from the connected database sqlite crashes as there is no such table. Even though the PRAGMA database_list sqlite command displays the connected database file, implying that the attachment was successful. Answer db_2_name’s value is a string that
How to use timestaffdiff in DerbySQL to find the records with the time gap not larger than 1 hour?
So I’ve tried to use the timestamp diff to calculate and get the results with time gap not larger than 1 hour from the current time. However, it is not working as intended. When I run the code, all results with gap more than 1 day are displayed, as screenshot below with my current timestamp as reference. the results returned
SUBSELECT (SQL)
I have to tables. The first table (customers) shows data about the customers (id, firstname, lastname). The second table shows data about the orders (timestamp and customer id). So, i wanted to see the last order by a customer in my table “customers” and did a SUBSELECT and it worked. But, there are some customers who never ordered something and
SQL make 2 columns into 1 from 1 table keep all rows in SELECT query
I am dealing with a DB whose transaction table could have been split up into 2, but dev team decided it was not worth it. Now I want to retrieve the transactions and their dates. Problem is : table includes 2 different types of transactions, meaning: I have 2 date columns : “transaction_date” and “beta_transaction_date” (I am modifying the names
What do you call the . syntax in SQL?
In many databases, when writing a SELECT query, you can provide the database name along with the table name in order to resolve any ambiguity the database might encounter in case there are multiple databases with the same table names. For example, let’s say the user currently logged into SQL Server has SELECT privileges on databases DB1 and DB2, and