Is it possible to get a the sum of value from the calendar_table to the main_table without joining like below? I am trying to avoid a join like this because main_table is a very large table with rows that have very large start and end dates, and it is absolutely killing my performance. And I’ve already …
ORA-06502: PL/SQL: numeric or value error when concatenating
I am getting error as numeric or value error Answer The problem is with operator precedence: Oracle evaluates operators with equal precedence from left to right within an expression. … and as the table shows + and || have equal precedence. So in this statement: this is interpreted as ‘sum = ‘…
Query to return two columns from single field with mutually exclusive constraint
I wanted to get two columns displayed basically from single field; one with current plan value and other with the immediate previous plan with the below table structure. I want to select only records …
syntax error at or near “JOIN” for postgresql
I am trying to join two tables, and for some reason I keeping getting: ERROR: syntax error at or near “JOIN” My code is: SELECT c.visit, d.cake FROM customer c, INNER JOIN …
SQL Select unique foreignkey from N tables
I got the following problem and want to know if it’s possible to solve it with a query in Google BigQuery. Got this query; SELECT destination.Id, destination.SomeColumn, (SELECT NewId FROM table1 …
How can I select data from this week using a Unix timestamp in SQL?
I have two columns in my database named dtp_s and dtp_e. Both of these columns hold strtotime() formatted ints which I then use in my PHP application to calculate hours/minutes between time intervals. …
Sql query with max value in where condition
I have a query which should return one row if the conditions are met. This query compares columns from 3 tables and should use the max value of DEGREE_HIERARCHY since there can be more than one value. …
Insert rows into same table using data from different rows based on data from another table
I’ve got 2 tables: TimecardSetDetails, TimecardDetails TimecardSetDetails +————–+————-+————–+ | SetDetailsID | EmployeeKey | SetHistoryID | +————–+————-+—–…
Intersection of Records in Postgres
Suppose I have labels with multiple stores associated with them like so: label_id | store_id ——————– label_1 | store_1 label_1 | store_2 label_1 | store_3 label_2 | store_2 label_2 | …
Want to concatenate column of the second query to the first query but getting errors such as “query block has incorrect number of result columns”
SELECT ID, PRIM_EMAIL, SEC_EMAIL, PHONE FROM STUDENTS.RECORDS WHERE ID IN (SELECT ID FROM STUDENTS.INFO WHERE ROLL_NO = ‘554’) UNION SELECT NAME FROM STUDENTS.INFO WHERE ROLL_NO = ‘…