How to combine 2 Google Sheets Query tables chronologically by Date? - google-sheets-formula

I currently have 2 Google Sheets with their own respective tables, Table1 and Table2.
Table1 is located in the example below from Column A to Column C. This was Query 1.
Table2 is located from E to G. This was Query 2.
My desired outcome is Table3 located in Column I to K.
Both of these table have been imported from separate sheets into my newly created sheet using 2 different Queries.
Here is an example of the code that I used:
=Query(IMPORTRANGE("url_example1", "Sheet1!A1:Z"), "select Col1, Col2, Col7", 1)
And another:
=Query(IMPORTRANGE("url_example2", "Sheet2!A1:Z"), "select Col1, Col2, Col7", 1)
Is there a way to combine both tables chronologically with 1 Query?
If not, what is the best way to accomplish this goal? Any help would be greatly appreciated.
Again my hope is to combine 2 Google Sheets Query tables into one table and have the data sorted chronologically. Thanks for your time.

use:
=QUERY({IMPORTRANGE("url_example1", "Sheet1!A1:Z");
IMPORTRANGE("url_example2", "Sheet1!A2:Z")},
"select Col1,Col2,Col7
order by Col1 asc", 1)

Related

How to give dynamic columns in select query by selecting columns from another table result

I am looking for some help on below issue:
I am getting column names from the XML column in one query, and I wanted to pass those column names in another query.
below is the sample structure of my query:
with temp1 as (
select x
from table1)
select (select distinct x from temp1) from table2
when I have given like above it is displaying column name text, not data from another table, can someone please help me to solve the issue.
Thank you.

updating a table in VFP

There are two tables in my database. I am trying to update a column in table2 by setting it equal to one of the columns in table1. I've already looked at this answer visual foxpro - need to update table from another table
And tried to do this on my code, however, I kept having a syntax error on UPDATE table2. Why?
Here is what I have.
ALTER TABLE table2;
ADD COLUMN base2 B(8,2);
UPDATE table2
WHERE table2.itemid=table1.itemid from table1;
SET table2.base2=table1.base;
The simplest syntax is:
update table2 from table1 where table2.itemid = table1.itemid ;
set table2.base2 = table1.base
You could also add more fields to update separated by commas, i.e.
... set table2.base2 = table1.base, table2.this = table1.that
Using 'standard' VFP language syntax and RELATED Tables, you could quite easily do the following:
USE Table1 IN 0 EXCLUSIVE
SELECT Table1
INDEX ON ID TAG ID && Create Index on ID field
USE Table2 IN 0
SELECT Table2
SET RELATION TO ID INTO Table1
REPLACE ALL Table2.ID WITH Table1.ID FOR !EMPTY(Table2.ID)
You might want to spend some time looking over the free, on-line tutorial videos at: Learn Visual Foxpro # garfieldhudson.com
The videos named:
* Building a Simple Application - Pt. 5
and
* Q&A: Using Related Tables In A Report
Both discuss using VFP's language to work with Related Tables
Good Luck
Use join
Update table2 b
Join table1 a on b. Itemid=a.itemid
Set b. Base2=a.base

Capybara- how to select multiple table rows using xpath

I want to select multiple table rows the same time. table row 2 and table row 3 they both have the same id, is there a way to select the two table rows at the same time? currently I am trying to approach using xpath in-order to do that I need to join the two xpath but no luck so far.
here is my sample:
find(:xpath, ".//*[#id='review']/tr[2]/td[2]")
find(:xpath, ".//*[#id='review']/tr[3]/td[2]")
so I just want to select the two table rows (tr[2]and tr[3]) then they both highlighted(selected)

Select all data from multiple tables non-relationally

Put simply, I want to select all data in two columns from each of six tables using one query. All six tables have these same two columns. They aren't relational tables and so there is no need to relationally join them.
The obvious (but apparently wrong) way to do it would be:
select col1, col2 from table1, table2, (... etc)
However this gives a "ORA-00918: column ambiguously defined" error. I've tried a variety of other things including some rather poor sub-querying but haven't managed to get any workable results.
Any suggestions for how to do this? Thanks.
My guess is that you're looking for something like
SELECT col1, col2 FROM table1
UNION ALL
SELECT col1, col2 FROM table2
UNION ALL
...
SELECT col1, col2 FROM table6
If that's not what you want, it would be helpful if you could post some sample data and the expected output.

Updating a SQL table where items to change are identified in another table that is linked

Everywhere I look I can find how to update a table from data in another table but I am not looking for that. I have two tables TABLE1 and TABLE2. TABLE1 has a column PULLDATE and a column JOBNMBR. TABLE2 has a column JOBNMBR and a column PROJECT. The two tables link at the JOBNMBR column. I need to do a bulk update to TABLE1.PULLDATE per a project number, but that project number is stored in TABLE2.PROJECT.
Using VisualStudio 2005 and in VB code not C+, does anyone know the code (if there is any) that links the tables and allows me to update all TABLE1.PULLDATE records grouped by TABLE2.PROJECT? I will be providing the trigger to update using a textbox [TxtBox_Pulldate] and a nearby button [Button_UpdatePulldate].
Thanks a bunch
Chuck Vensel
I think I understand that you want to update Table1 given a matching column in Table2?
You write the SQL update just as you would the SELECT except replace the SELECT clause with the UPDATE clause.
UPDATE Table1
SET
[PULLDATE] = your_value
FROM
Table1
JOIN Table2
ON Table2.[JOBNMBR] = Table1.[JOBNMBR]
WHERE
Table2.[PROJECT] = your_project_ID

Resources