I have year in YYYY format and I want to convert it to FYYY format. So, for instance, 2014 will be FY14, 2009 will be FY09, so on and so forth. I’m creating a View that contains a SUM aggregate …
How do I convert Months from Numeral to String Form in SQL Query Containing GROUP BY?
So, I’m creating a View that pulls a bunch of data (with a SUM aggregate on one field). The query contains GROUP BY clause and when I do the month conversion in the query as follows, I get an %invalid …
Hive Insert Overwrite Table
I’m new to Hive and I wanted to know if insert overwrite will overwrite an existing table I have created. I want to filter an already created table, let’s call it TableA, to only select the rows where …
last quarter and next quarter
I would like to get the dates for the last quarter and next quarter. I have tried: SELECT convert(date, DATEADD(q, DATEDIFF(q,0,GETDATE()) -1 ,0)) FirstQDate, convert(date, DATEADD(s,-1,DATEADD(q, …
How to fetch multiple columns from multiple table and show data on non empty columns and null or zero on empty columns using joins in MYSQL
I would like to know how to fetch multiple columns from multiple table even if one column in one table does not exist and return the columns which ever exist in one or more table used for joins Ex: Tables: SQL: Problem: What I need? If a column doesn’t exist in one table then return the rest of the colu…
Random and duplicates with order by?
Suppose I have a table like so, What I need to do, is randomize this SELECT query, but in a very two particular ways that I just can’t figure out how to do. Firstly, I want unique_data randomized, so that the SELECT query could return something like (randomly): The second requirement I have is that, uni…
CASE Statement for Order By Clause with Multiple Columns and Desc/Asc Sort
Following on from my earlier question here Case statement for Order By clause with Desc/Asc sort I have a statement like this: This works well, but sometimes I need more than column in the order by. I actually need something like this: I can’t work out how to make the CASE statement allow multiple colum…
Import Data into Excel from Access Table
I am trying to import data into Excel from an Access table. I am getting a syntax error This error comes up when I run the line: Select [Time], [Tank], FROM “UnitOneRouting”, WHERE [Date] = ” & RpDate & ORDER BY Tank, Time”, cn, adOpenStatic, adLockOptimistic, adCmdTable In the…
dbms_metadata.get_ddl not working
I want to get the DDL of Table CARD_TABLE in XT schema But my select Query works I queried dba_objects it still got the table: Answer From the dbms_metadata documentation: If nonprivileged users are granted some form of access to an object in someone else’s schema, they will be able to retrieve the gran…
Creating EVENTS in SQL Server
I want to execute a query at a specific time. In MySQL we use events for that, example is as follows: CREATE EVENT myevent ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO UPDATE …