Not really sure how to title this question, but here’s the situation. I have one data frame (dfOrders) that has an order_id and basic information like so: |order_id|full_name|order_date|billing|…
SQL Retrieve info from two tables
I am really lost with sql.. i tried to read everything but no luck. I have two tables and need to retrieve data from them: First Table – Workers | Second Table – Stores Select workers first name that belong to more than one store? Select all workers first name that are in the shoe store? Hope you …
Querying JSON (specific situation)
I am trying to query a specific example of JSON, see below: The column name is “values”. If I use values -> ‘members’ I will get everything underneath. However, if I want the “gender” using values …
SQL – Prepend a value if missing
Code/data: DECLARE @T TABLE ( [Col1] VARCHAR(20) , [RowNum] INT ) ; INSERT INTO @T VALUES ( N’second’, 1 ) , ( N’fifth’, 4 ) , ( N’fourth’, 3 ) –, ( N’zzz’, 1 ) …
get sum of all rows with id from main query
I need the sum of all positions from one year for every customer. In the subquery i’ve hardcoded the customernumber (mark 1) but it needs to be another customernumber for every row. The values in mark 2 are wrong. Thanks for your help! Answer If BAS_Customers and BAS_Contacts have a one-to-one relations…
MySQL: How to hold lock and make other threads wait for an insert that hasn’t happened yet
I’m confronted by a seemingly simple problem that has turned out to be pretty hard to figure out. We want to keep a record of every time we’re presented with a piece of marketing (a lead) so we don’t …
How to merge many rows with the same ID with SQL Server
I need the help from the community to solve the following problem that I found (I’m using SQL Server): I have two tables, USER and INFO. USER: ID NAME ———- AAA John BBB Mike INFO: ID …
PostgreSQL: How to use REPLACE with dynamic replacement text
I am trying to generate the string, download_url, for each row of the dataset table using REPLACE with a simple template string. The id of each row should be substituted into the template string. …
Is it possible to remove milliseconds from TO_TIMESTAMP function
I have this query which gives me this output its fine except for .000000000 part. I dont need that part, and im not sure how its coming up if its HH:MI:SS format this is for oracle sql developer. Answer Why not just convert to a date? That datatype doesn’t have fractions of a second:
Spark Scala Compare Row and Row of 2 Data frames and get differences
I have a Dataframe 1, Df1, Dataframe 2 , Df2 – Same Schema I have Row 1 from Df1 – Dfw1, Row 1 from Df2 – Dfw2 I need to compare both to get differences b/n Dfw1 and Dfw2 and get the differences out as collection (Map or something) Answer A simple solution would be to transform the Row objec…