Is possible join paths in one query of AWS Athena? - join

Be studying use Athena in my project, but i dont't found possiblity of join folders in one request of Athena.
Example
i have datalog in folders day1 and day2, and i my query i need get data of both folders. In unique query! it's possible?

A table in Amazon Athena points to one folder in Amazon S3.
Therefore, you could:
Create a table for day1
Create a table for day2
CREATE VIEW days AS SELECT * FROM day1 UNION ALL SELECT * FROM day2
SELECT col1, col2 FROM days
The View will act as the combined table for day1 and day2.

Related

Import Range Query not importing data

Sorry I know this question has been asked before - I have tried changing my query around but can't seem to get it to work as expected, doesn't look to be anything wrong..
I am simply trying to query data from one large master sheet into a few separate sheets. I am using importrange to get the data from sheet, and a simple select query to filter by one of the columns. If I do a select * I get all the data as expected, but can't use a WHERE clause with any column (I just need 1 of the columns, but I tried with a few different ones).
Appreciate any help!
Query:
=QUERY(IMPORTRANGE("1sNA9u2uQW-XjEKjrVS2a5LtTPCchwSuTkXfjhTJtvPk","Sheet1!B:I"),"select * WHERE 'Rank'='LTC' ")
Columns
Username Rank Time In Service TIS Time In Grade TIG Promotable Awards PLT/SQD
Source sheet: https://docs.google.com/spreadsheets/d/1sNA9u2uQW-XjEKjrVS2a5LtTPCchwSuTkXfjhTJtvPk
Test sheet: https://docs.google.com/spreadsheets/d/1UCucsfE0M4j95d_47iN0LrAhS0luv8wXVMHRVTHJHRQ
As player0 stated, you should refer to the columns by its number, you can select multiple columns and state multiple "where" statements by using Col1,Col2, etc respectively. In this case: Where Col2 = 'LTZ'
try:
=QUERY({IMPORTRANGE("1sNA9u2uQW-XjEKjrVS2a5LtTPCchwSuTkXfjhTJtvPk", "Sheet1!B:I")},
"where Col1='LTC' ", )

How to SUMIF identical data spread out on multiple columns

I using excel to organize my cut list for a panel board. I have a table created like so, and i need help creating a formula that adds the number of pieces of panels of identical dimension and material, regardless of which panel it belongs
I have done formulas before where the datas where in a single column and there was only 1 criteria to check using UNIQUE and SUMIF formulas. I can already extract all the unique dimensions using
=UNIQUE(FLATTEN(C17:C19,E17:E19,G17:G19))
but that all that i got for now.
try:
={"Material", "Dimension", "Pcs";
QUERY({A2:C9; A2:A9, D2:E9; A2:A9, F2:G9},
"select Col1,Col2,sum(Col3) where Col1 is not null
group by Col1,Col2 label sum(Col3)''", 0)}

How to select specific columns from array in Google Sheets query?

Let's say you only wanna select the first column. Cannot, it says 'NO_COLUMN: A'.
=query({O2:P4;O8:P9},"select A")
It is easy to select ALL columns.
=query({O2:P4;O8:P9},"select *")
use:
=QUERY({O2:P4;O8:P9}, "select Col1")
Another option is to use the index of columns you want to select. The advantage here is that you can make complex references to other spreadsheets and data ranges that you would not be able to do easily using the "select" statement. Below is an example with simple references though. For example: if you need to select columns A and E (1st and 5th column) you would use the following formulae:
={index({A:X},0,1),index({A:X},0,5)}

How can I combine multiple columns into one column in Google Sheets?

(Note: Please simply look at the Google sheet for the quickest understanding of what I'm describing in the below bulletpoints)
My data has rows which each represent an order
Each order (row) can consist of multiple products
For each product in an order (row) there is another set of columns in the same row
I need this data to convert into only one set of columns per row (i.e. one product per row)
The products (new rows) need to remain next to eachother so the columns can't just be added to the bottom of the array (which is more simple)
Can you please take a look at the example below and help me achieve this?
Example Sheet
Screenshot of linked sheet
Try this in another sheet
=SORT({query({Reference!$A5:$A,Reference!B5:F},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!G5:K},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!L5:P},"select * where Col2 is not null ")})

Add column with cell values to tables merged using Query

I use this Query formula in Google Spreadsheet to merge tables from many source sheets into one table:
=query({Data1!A4:B;Data2!A4:B;Data3!A4:B}; "select * where Col1 is not null")
To distinguish original tables in the merged table, I need to add new column to the merged table with their identification. The indentification string is in cells on every source sheet. How to do it?
This is example spreadsheet I prepared for tests. Copy it to your Google Drive to make changes please.
https://docs.google.com/spreadsheets/d/1YimEsiDa3gTiKqv7DMohfNvBDruvQ13zrK23Y3R3Gsw/edit?usp=sharing
I suspect the simplest way is the "long-winded" add a column in each sheet (say a new "A") and populate that with the sheet name, so then a query like so:
=query({Data1!A4:C;Data2!A4:C;Data3!A4:C}; "select * where Col2 is not null")
Edit re Comment:
Not the layout required but at least differentiates the source without adding anything to the sources:
={query(Data1!A4:B,"select * where A is not NULL label A '"&Data1!B1&"'");query(Data2!A4:B,"select * where A is not NULL label A '"&Data2!B1&"'");query(Data3!A4:B,"where A is not NULL label A '"&Data3!B1&"'")}

Resources