I added a field to my existing table and now I have to update the old entries to have the right values. UPDATE shift_job SET elapsed_time = ROUND(EXTRACT(EPOCH FROM actual_end_time – …
Tag: sql
Aggregate rows based on MIN flag
I’m thinking this is an easy one but the answer is escaping me. Example: I have a query returning 10 rows, some of which are identical except for the last 2 columns which are a comment and a number(…
How to get every nth row value in sql
I have a select statement in sql: SELECT DISTINCT [Year] FROM [data_list] ORDER BY [YEAR] ASC; Result: Year —- 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 I want list of year in 3 …
DUAL alternative in ms access database
I am working with windows forms in VB.NET and MS Access database. I need to check that if user already exist in my database or not and take further action accordingly. After searching for awhile I …
Solving Query-Errors in Vertica [Vertica][VJDBC](4160) and [Vertica][VJDBC](4680)
I have some issues in getting my Vertica query to work correctly. Let’s assume I have a relation which is defined as follows: CREATE TABLE KOMM ( MANDT VARCHAR(3), DOCNUM …
Convert VARBINARY to Base64 in MySQL
This seems like a basic scenario, but I can’t find relevant info anywhere. I’m new to MySQL, coming from years of Microsoft SQL Server experience. In MySQL, how do you convert a BINARY or VARBINARY value into a Base64 string, and vice-versa? In Microsoft SQL Server, I’ve been using code like…
Compare Columns from Separate Schema in SQL using TOAD Oracle
I am trying to extract data via a unique identifier from two separate schema in TOAD for Oracle using SQL. Normally, I would export to Python and work the csv from there, however, in this case, I must …
How to set where clause dynamically in GORM
I will receive a map[string][]string. For each key in the map i want to add where clause like bellow. inFilter := map[string][]string{“product_id”: []string{“3”, “69”}} for key, value := range …
Select Distinct and show records where X column is not the same
I have a database with a structure of: I am struggling to write a query to show me where ‘Supp’ is different. (Supp Should be the same for all records, So i need to identify records effected to correct) The table contains more than 55,000 lines Just a list of Codes where Supp is not the same for e…
Need to Update Offdate of Component Only Where it’s Used Alongside Another Component
I need to update the offdate of a component (322058-000000′) of a parent part where the component in questions is used along with another component. The following code gives me the component (322058-000000) and the instance where it needs to be changed. It needs to be changed where it is used along with…