I’m trying figure out how to return Start Date and End date based on data like in the below table: Name Date From Date To A 2022-01-03 2022-01-03 A 2021-12-29 2021-12-31 A 2021-12-28 2021-12-28 A 2021-12-27 2021-12-27 A 2021-12-23 2021-12-24 A 2021-11-08 2021-11-09 The result I am after would show like …
Tag: sql
Round up to the next whole number case it contains decimal point (In SQL Oracle)
I need to retrieve a field from a table and display the results rounded up to the next whole number if is not whole yet. For example: I have in my table the field working hours. I need to create de following logic. Else select as it is (4.0). Answer Is this what you want?
Wildcard for string before @ character
How would I use a wildcard to filter out any permutation of the following. There can be any number of zeros before the “@” character. Example Basically, I’m looking to wildcard any email address with only zeros before the @ character. Any help would be greatly appreciated Thank you ! Smiddy …
Tricks to exceed column limitations in SQL Database
Hello swarm intelligence! I have the following use case: For every movie that is requested by a user, I create a number of tags for that specific movie, derived from several sources (actors, plot etc.. ). I will use this data for associaton mining. The problem: If I use the movie for rows and the tags for col…
Take last value in sequence
I am trying to insert data into my target table from my source table where in the target table I have an additional column called SaleTo. SaleTo = the SaleFrom based on the MAX SaleSequence. Example of the source table: SaleNo SaleFrom SaleSequence 1 Alabama 2 1 Minnesota 1 1 Virginia 3 Example of target tabl…
SQL insert multiple values and parent id by selecting from same table
How do I insert multiple values and parent id by selecting from same table I tried below and getting an error MySQL said: Documentation #1093 – Table ‘ctg_tbl’ is specified twice, both as a target for ‘INSERT’ and as a separate source for data Answer Your query can be made to wor…
Issues creating a function
Thank you for reading my post and trying to assist. I am pretty new with PostgreSQL and am struggling with trying to create a Function to transform a table column that is currently integer (1,0) into ‘Yes’ or ‘No” and redisplaying the table after the change, what’s your recommend…
What part of my query is invalid with MySQL 5.7?
I have created the following query: It works during development but after testing it on the production server (which is uses MySQL 5.7) I get the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘cte1 A…
Parameter returning not in the correct format
I have an async task method that queries a database table for the total amount of Credits in a specific column. I have a string parameter in the method that I use for the query to identify which user is logged in, which is stored in Properties.Settings.Default.Student_Number;. The column for the student numbe…
Bigquery error when powering negative number with decimal(float64)
I’m trying to calculate the CAGR using the formula in BigQuery When running the query, somewhere in middle the values become POW(-0.0310044, 0.333333) and I’m getting error I tried calculating the same value in a calculator and I get the result. What could be the problem and how do I solve it? Ans…