1
votes

I have the following query to combine three tabs in a Google spreadsheet:

=QUERY({'Stock 1'!A:N;'Stock 2'!A2:N;'Stock 3'!A2:N};"Select Col1, Col2, Col3, Col4 Where Col3<>''";1)

In the grouped tab (Total Stock) I want to change all cells of column D (Col4) to "Company 1"

Is there any function similar to "set" in SQL?

Example:

https://docs.google.com/spreadsheets/d/1zGaka_DK5SPeRE-LAB7pK7NJ6I9bRUx4G6cgb_4inGg/edit#gid=2081907934

2
share a copy of your sheet with example of desired outputplayer0
I shared the spreadsheetLucas Góes

2 Answers

1
votes

try:

=QUERY({'Stock 1'!A:D; 'Stock 2'!A2:D; 'Stock 3'!A2:D}; "where Col1 is not null"; 1)

0


or:

=QUERY({'Stock 1'!A:D; 'Stock 2'!A2:D; 'Stock 3'!A2:D}; 
 "select Col1,Col2,Col3,'Company X' where Col1 is not null label 'Company X''Company'"; 1)

0

0
votes

Instead of

"Select Col1, Col2..., Col12 Where Col9<>''"

just put

"Select Col1, Col2..., 'Company X' Where Col9<>''"