Skip to content

Getting not valid month in Oracle sql

I have a table called Transactions that has a column called trans_date. I am just trying to do a simple query in the SQL*Plus command window The query is When I run this query I get not valid month and there is a little * under trans_date. Most of what I have read suggests the query is right but I

Missing IN or OUT parameter in Oracle SQL

Im getting an error on this parte of SQL{ “U” = UPPER(:codigo) }. When i remove the variable and hardcode :codigo as u or U it works fine. The erro i receive is Missing In or Out parameter. I’m receiving this error on Oracle 12c Service Bus Full SQL: Answer The problem was: Each time variabl…

SQL Server: Counts and Percentage by Group

I’ve tried the suggestions I’ve found on SO and cannot get the results I’m looking for which is this: I am able to get the first two columns with this code: — What I’ve tried: Trying to use a calcuation in a subquery to represent the total number of rows in the table is beyond me…

SQL Row Data to Column Data in Join

Trying to wrap my tiny brain around how to write this query and I am at a loss: Current: How I would like it to look: If someone can point me to a function that could help me with this, it would be much appreciated. I already tried using: max(case when ….) and pivot() which I found in other articles,

SQL how can i detect if a value decrease over time?

Hi, how can i check who are the employees whose salary has fallen ? : I only want to fetch the name of employees whose salary has fallen Answer You can use the positional analytic function LAG() to find these rows. This is a standard SQL function that peeks at a previous row, according to a specific criteria.…

Delete node when child have a certain value is found

I intend to remove a node whenever I find the unit_qty tag with the value equal to 0.0000. For example considering that the message below is called MESSAGE_DATA: the purpose of message_data is to return the following: I’ve already tried the following options: I don’t know if I’m looking up t…

SAS – Group By not working due to case statement in Select

I have an issue where some SAS code using PROC SQL isn’t working as there is a case statement around one of my calculations. The code looks like the below: This code returns duplicated rows for the number of rows in table A. Removing the case statement as below: This just returns the group by using the …

SQL complicated SELECT query

I would like to have a select query, where I get all the games that a specific user played with the points of his and the opponents team. Entity relatioship model of my database This is my current query: The current query gives me this result: userId gameId won points 1 1 true 19 Problem: From this query I on…