I’ve written a select statement to assist with timesheet approval. It show’s the summation of hours entered against a user based on different roles booked, i.e. Standard Office Hours, Overtime, Holiday & Offshore. I want a single row per [Name] but I get a row for every SUM where the user has data. Do I need to create this as
PostgreSQL: `VIEW` returns no rows with `SPLIT_PART()` columns
Problem Description: Hi everyone, I’m having some troubles querying on a VIEW whose columns are, in part, the result of SPLIT_PART() function on og table’s column; I created the VIEW as it follows: My intention was to divide the structured attribute (Clients.Address defined as a string VARCHAR(255)) which contains all the informations releated to client’s domicile in several columns to
calculate upcoming category based on the dates of the past categories [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I have the above table structure in the database and I want to calculate the upcoming abbreviation for an id (if a particular abbreviation has
Insert records into one table using key from another table
I have a table with year, start and end columns like below. It has several years in it. Do not ask me why there is a year called 4 in there because I could not tell you. I just know that it cannot be removed from the table or else the web application will break. I use this query to
RANK data by value in the column
I’d like to divide the data into separate groups (chunks) based on the value in the column. If the value increase above certain threshold, the value in the “group” should increase by 1. This would be easy to achieve in MySQL, by doing CASE WHEN @val > 30 THEN @row_no + 1 ELSE @row_no END however I am using Amazon
Common Data Type in Oracle for reusability
I have data type with fixed column data type and size. For example, If you see above I have CREATE_USER char(36) in almost all tables. I want to make it replaceable. So that in future I can change the type/size. For example, I call it CREATE_USER myDataType, so that in future I need to replace it only one place. Is
Is there a wait method for Google BigQuery SQL
I’m scheduling a query to run every day that picks up data from a table that get’s written to Google BigQuery automatically. Usually the table is there, but I’d like to be sure before I execute the query depending on this table. I’m looking into other ways as well, but the simplest way seems to be to use just SQL
Laravel Eloquent, group by week and display start and end of week
I have the following code, which return a collection of Orders grouped by week. The result is the following, with, Obviously “05” being the week number. But to the proyect i’m currently working this is not the way I want to show it. Is there any way to display or return the week start and week end and not the
How to count “Sunday” of the month to count absent employees
I have a problem calculating employee absenteeism in a month. In my query it still counts the day of the ‘sunday’ in this month, which shouldn’t count. This is an sample database used : emp0003 table’s NIK Name 01190301 Susan dvc0004 table’s NIK Enroll 01190301 2021-02-08 07:20:39 01190301 2021-02-06 14:37:08 01190301 2021-02-06 07:57:42 01190301 2021-02-05 17:29:00 01190301 2021-02-05 08:09:54 01190301
Is using OPENXML() the best way to transform data in an XML Column to Rows and Columns?
I have a SQL Server table with a column of type XML. The XML data represents multiple allowable selections for a given field. An example of the XML data is as follows. I am using the following code to extract the data from the XML column and transforming it into rows that can be inserted into a new table. This