Can a link other columns to a data set - database

I am pulling the first two columns from a database, the information is automatically populating in the gsheet. I have added column C and D for more information. This info in C and D is manually updated. How can I make all the rows static so that if information from A and B is removed or added from the database then C and D can be removed/added as well, and not shift incorrectly. Is this possible?
any formula I can use to say if this row is deleted, delete other rows in the different columns?

Related

Google Sheet Concatenate certain cells contents of selected rows

I have a table with two columns. Column A includes dates and column B contains simple text. The date column has duplicates. What I want to have is concatenate the contents of column B cells for identical dates. Basically, similar to running a query and grouping on the date column with an aggregate function like sum() on column B; but there is no aggregate function for text. The solution needs to be for a dynamic list, as the input is made via a google form by the users.
This link offers a solution but you have to copy and paste the rows.
Many thanks
Sabba

Transfer data from one column to a different column in a different table

I've got table A and table B in a database. I'm trying to move the column in table A to table B without losing any data. Not sure if its best to move the column somehow or make a whole new column in table B then copy the data over?
The problem is that the database is already in production and I don't want the clients to lose the data that is currently stored in column X in table A. I thought of making a migration to create the same column X in table B, and then somehow copying the data there. I am not sure how to do that, and I couldn't find a similar problem here.
if you have phpmyadmin you can do this pretty easily. this command should work:
INSERT INTO `tabletwo.columnb` (SELECT 'columna' FROM tableone)
Always back up the dbs, load local and try this, never live lol. I'm sure your aware. :)
Note: columna and columnb are placeholder for your actual column names
I think you can create the migration table to create de column on table B.
After you can use tinker ("php artisan tinker" on the terminal) to move the desired data on the table A to the B.

SSIS sync two tables on different servers

I am a starter of SSIS. If you have any guidance, please be specific. Thank you.
I am trying to sync two tables on two different servers.
Table A on Server A(60k data) and Table B on Server B(60k data).
there are mainly 3 things:
Add new records where they are in Table A not Table B.
Update records where Table A and B both have and update them.
Delete records where they are not in Table A, but in B
There are no primary keys in both tables. But two columns together can mostly help to find certain records(there are duplicates each table, but not many)
http://www.rad.pasfu.com/index.php?/archives/150-Insert,-Update,-and-Delete-Destination-table-with-SSIS.html
I've tried to use this guy's method to figure it out, but failed. I tried this way on two sample tables which has a couple of lines of data, successful.
On real tables, I set Column A and B as SortKeyPosition 1 and 2 since I have to use them together.
Full outer join at Merge Join
Conditional Split for New Records as below:
(!ISNULL(S_Column A) && !ISNULL(S_Column B)) && (ISNULL([D_Column A]) && ISNULL(D_Column B))
Delete Records as:
(ISNULL(S_Column A) && ISNULL(S_Column B)) && (!ISNULL([D_Column A]) && !ISNULL(D_Column B))
As a result, I got 34k data for new records and 0 records for delete ones.
I've tested on SQL for the real result, 1000+ for new records and 600+ for deleting ones. 60k around needs to be updated. I don't know what causes this problem and how to fix it.
Updating: I personally used a OLE DB Command to write SQL command replacing all data(some of the data don't need to be updated) after conditional split(assuming I am doing write before). I am looking for better solutions for updating too.
Hoping to get helped! Thank you again and early happy holiday!
Try the following steps:
COPY table from ServerA to a working table on ServerB
Handle Duplicates by theoretical index
Are these 'duplicates' differentiatable by adding additional fields?
If so, add those fields to the indexing.
If not, assume that all of these rows on ServerB will end up looking like one row from ServerA
DELETE rows from B that do not match rows from A
UPDATE rows in B where the keys match in A but data differs (it is worthwhile to compare the data and only update if the data is actually different).
INSERT the new rows from A
DROP or TRUNCATE the working table.

Visual Studio 2013 LightSwitch How to limit options in popup window when adding linked field data?

I have Visual Studio 2013 LightSwitch. My app is deployed to Azure. My SQL database is on Azure. Tables and links are created and working.
Problem 1: In Table A, when adding or updating data, I want to select data from fields in records based on primary key in other tables. Add and update data works. But my popup "X" list is way too long. I want the popup "X" when adding or updating record in Table A to only give me the choice of records from Table B that matches the data I entered in a previous field in Table A, not all the records from Table B.
Problem 2: Then while adding or updating Table A, I want the data from certain fields of the selected record in Table B to be transferred to certain fields in Table A. (Let's say - If I select "ABC" from the popup "X" in Field 2 in Table A, then when I am selecting something from the popup "X" in Field 3 in Table A, I want to select only from the records in Table B that match "ABC" in the primary key field of Table B, not all the records.
Problem 3: If the popup "X" list doesn't include the necessary record to put in Table A, then I want to add a record in Table B to include it in the popup list.
Problem 4: How do I get my popup "X" list to include more than one field? Is creating a new combined field the preferred way?
Problem 4: I also need some good help with user text input and getting the text into my online database. The thought of using an Intrinsic Database gives me the willies.
In your detailed solution, remember I am more familiar with Visual Basic than C#. Thanks.
I'm not quite sure what you mean by popup X list but I'm going to assume you mean an Auto Complete Box control as that would be the default control for linked data. To achieve what you want for problem 1, you need to create a query on Table B with a parameter for the selection field of Table A. You then assign that query to the Auto Complete Box by changing its Choices setting from Auto to your new query. Changing your selection on Table A automatically filters the available selections in your query on Table B.
Beth Massi explains in detail here - there isn't much code involved but her examples are in VB. I'd figure out problem 1 first and then see if that helps clarify the remaining ones.

Dynamic PIVOT with varchar columns

I'm trying to to pivot rows into columns. I basically have lots of lines where every N rows means a row on a table I'd like to list as a result set. I'll give a short example:
I have a table structure like this:
Keep it in mind that I removed lots of rows to simplify this example. Every 6 rows means 1 row in the result set, which I would like to be like this:
All columns are varchar types (that's why I couldn't get it done with pivot)
Number os columns are dynamic, so it's the number of rows in source table
Logically, Number of rows (table rows in result set) are equally dynamic
(Not really an answer, but it's what I've got.)
This is a name/value pair table, right? Your query will require something that identifies which "set" of rows is associated with one another. Without something like this, I don't see how the query can be written. The key factor is that you must never assume that data will be returned from SQL (Server, at least) in any particular order. How the data is stored internally generally, but not always, determines how it is returned when order is not specified.
Another consideration: what if (when?) a row is missing -- say, Product 4 has no Price B column? That would break a simple "every six rows" rule. "Start fresh with every new Code row" would it problems if a Code is missed or when (not if) data is not returned in the anticipated order.
If you have some means of grouping items, let us know in an updated question, but otherwise I don't think this one is particularly solvable.
I actually did it.
I wrote a SQL while...do based on the number of columnns registered for the resultset. This way I could write a dynamic SQL clause for N columns based on the values read. In the end I just inserted the resultset in a temp table, and voi lá.
Thanks anyways!

Resources