Thank you very much for looking at this post :). I have the following problem: I have a piece of SQL code that runs perfectly on the Oracle database. The problem comes when I try to run as JPQL code. I get the following error in the Eclipse IDE: Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904:…
Tag: sql
SQL Query — AVG for Occurrence Across Multiple Columns
I have a table like the following ID_A ID_B Avg_Class_Size 1 2 16 3 4 10 2 3 8 2 4 9 Where ID_A and ID_B represent distinct student ID codes, and AVG_Class_Size represents the average class size of the classes shared between students A and B. I would like to calculate the average of the “avg_class_size&…
Correct value of a json data saved using JPA, spring and kotlin Map
I have a jsonb column in a postgres database where I store a bunch of key/value(1 level) into a column mappped to a a Map<String, Any). The values are supposed to be a String but in code I’m accepting anything. All saved values was passed as ByteArray(byte[]) and it’s stored without problems. T…
Dynamic Generate rows without using loops
How to dynamic generate row from max value for example if i am passing max value 7 Store procedure should return value 1 2 3 4 5 6 7 without using loops Answer
Recursive query in tree MySQL8 / MariaDB10
I have a tree-like structure for categories on my database: create table cat( id int auto_increment primary key, url varchar(50), parent int references cat(id) ) How can i build the …
Distinct IDs from one table for inner join SQL
I’m trying to take the distinct IDs that appear in table a, filter table b for only these distinct IDs from table a, and present the remaining columns from b. I’ve tried: SELECT * FROM ( SELECT …
execute multiple create view statements in snowflake
Is there a way to create multiple views in one query in Snowflake? I keep getting error when I try this – create or replace view forecast_view as select * from forecast where variable = ‘Name’ go …
SQL Query with criteria of 6 chars and wildcards
I’m stuck with an SQL query to get what I need. My input is this: COD SINOM A 123456 B 987654, 123456, 111111 C 123456 , 234501 D 9912345699 E 99123456, 789012 F 77123456 Both fields are …
show different columns from different table with inner join
Hi i have a lot of inner in a query but i can’t print column in different table, for example: where Table A id f ———– xxx gggg bbb kkkk Table B name code ———– ccc …
SQL, operation between paired rows
I have a table t1 a b 1 4 2 2 3 9 2 1 1 6 3 7 I need the output a result 1 4*6 2 2*1 3 9*7 I have been able to do it in a far from efficient way and would like a more …