so I need to find the highest and second highest date from every SKU(number) and compare these 2 dates and see if there is a 3 months difference. down below is my code I already found the second …
T-SQL – adding more date values to a table all rows
I have a table that contains many IDs as random numbers and I would like to create another table that contains all the IDs with another column having dates from first day of the year until a specific date. For example: My actual table looks like: And I would like to have a table if my specific end date is
how to take first value by rank or second in oracle select
I made ranking by using rank() OVER (PARTITION BY ? ORDER BY ? ASC) funtion. It is working fine. But I need to take 1st falue if max rnk of particular application_id value is 1 otherwise 2nd one. …
Select the first day and last day of this year in DB2
How to get the first day and the last day for the current year in DB2 in format YYYYMMDD? I tried: SELECT SUBSTR(CHAR(CURRENT DATE),8,0)||’0101′ And: SELECT SUBSTR(CHAR(CURRENT DATE),8,0)||’1231 …
convert date yyyy-mm-dd to mmm-yy SQL Server 2016
I want to convert date yyyy-mm-dd (stored as a date format) to mmm-yy format. There are no exact matches in the prior questions on the site. I have tried substrings and convert function, was …
SQL Query Exercise Oracle 18c
I’m trying to resolve this exercises: Visualize the actors who have had more than twice the compensation of the media of their compatriots. FILM (CODFILM,TITLE,YEAR,GENRE) –Year is NUMBER, it contains only the Year ACTOR (CODACTOR,NAME,SURNAME,NAZIONALITY) CAST (CODFILM,CODACTOR, COMPENSATION). I’ve tried this solution, but it doesn’t works Select, for each actor, the year in which he / she played the first
While display group of table value in mysql it shows each and every value as ‘0’
my table and it’s values are Now, i am going to grouping table but returns value in 0 While group the table it returns each and every column value returns in 0. Why that is happened. I need present or absent instead of 0. Can anyone solve this logic error? Answer sum(case when hour = ‘P1’ then status else ‘null’
Problems finding out Active users due to Hire/Resign Date
In my Employee table in SQL Server I have two datetime columns: HiringDate and ResignDate. I want to create a new column Status (Active, Inactive) in a view. If HiringDate is NULL or greater than today = Inactive If HiringDate is Active but ResignDate is earlier than today then Status also have to be Inactive. Do I have to make
An expression of non-boolean type specified in a context where a condition is expected, near ‘)’. error in SQL
I need to find matching id from two tables (client & activity), and update the data from (clientid) column in table client to the same column (id) the other table (activity): update activity set …
Given day, month and year, calculate weekending date
Given day, month and year as integer columns in the table, calculate the date and weekending date from these values. I tried the following but it gives me an incorrect result for the derived date as …