I want to swap dynamically values in column VAL2. The case is when in tech I have got X. I want to upload data from other rows where values in cells are the same ( the only difference is EN1 and EN2 ) because values there are reversed. ~~ SQL server I tried to update, case, but I do not
Tag: sql
SQL Query results into a already created table
I need some help getting the results from this query: To go into a table I have already created (Routegen). Routegen already has the columns (RouteNumber, DPS, Flats, Parcels). I’ve tried using SELECT INTO, but apparently I’m not doing it right because I can’t get the code to run after chang…
SQL query is only returning one entry, when it should be returning several
I am creating a book tagging system and I am trying to call all the books with the same tag. My query is only turning up the first book, and not any of the following books with the same tag. Here is …
How to I use the LIKE operator?
I’m doing a query using the LIKE operator, but it doesn’t work. When I run the query, there’s no results, but it says “Query executed successfully”. Does anyone know why? This is what I have …
How to select rows in parent table based on a value in child table
Consider the following tables, what would be an efficient query to return 1 row for each order that has at least 1 child row with a specific warehouse code? I am using SQL Server 2016. Table: Orders …
Dropping the index column from DataFrame in a .csv file in Pandas
I have a python script here: and when I run it, it creates separate csv files that are formatted in sql. The output looks like this in generatedfile2: The rest of the files have this same format. Is there any way I can change my code to get rid of the “2” at the beginning of the code? It won’…
Find Nth value and average value corresponding to each group in SQL
I have a table with name and grades for some users CREATE TABLE grades (name varchar(100), grade integer); insert into grades values (‘Bob’, 12), (‘Bob’, 13), (‘Bob’, 23), (‘Bob’, 17), (‘James’, 15), (…
SQL Merge the row into new column
I have a table named Addresses. The columns are: There is no data in Property as of yet as I will update it manually later. The rest of the columns does hold data though. However I need to merge Road, Town, Borough, District and Postcode into a new column named Full Address. So for example If you can see the
Joining two select statements together with outer join
My query on SQL Server: select s.learners_id, s.cv_student_id, s.first_name + ‘ ‘ + s.last_name student_name, p.program_name, dc.fulldate program_start_date, sd.discount_value, dt….
Case expression with Boolean from PostgreSQL to SQL Server
I am translating a query from PostgreSQL to SQL Server. I didn’t write the query in PostgreSQL and it’s quite complicated for my knowledge so i don’t understand every piece of it. From my understand: …