Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Select distinct from existing table into new table and append new column

Hello, I have the following two tables set up and working:

  1. Contract - A table with contract as unique key
    REF_ROWS("Nomination", "Contract")

  2. Nominations (One contract - Many nominations)

In my Nomination table, I have the following sample data:

Nomination_ID |    Date              | Contract  | Vessel Name |  Quantity
    abcde123       20/07/2021          1                A           1,000
    defgh234       20/07/2021          2                A           2,000
    hijkl456       21/07/2021          3                B           3,000

I would like to add, say, another column, Quality, for distinct values of Date and Vessel Name.

In SQL:

select
    distinct date, vessel_name
from nominations

The results of this query would be:

Date       | Vessel Name
20/07/2021   A
21/07/2021   B

And from here, the values for the new column Quality would only need to be added once per date and vessel, instead of multiple times in the Nomination table above.

Now, the user only has to update the Quality column twice:

Date       | Vessel Name | Quality
20/07/2021   A             1%
21/07/2021   B             2%

Instead of 3 times (per Nomination ID😞

Nomination_ID |    Date              | Contract  | Vessel Name |  Quantity | Quality
    abcde123       20/07/2021          1                A           1,000     1%
    defgh234       20/07/2021          2                A           2,000     1%
    hijkl456       21/07/2021          3                B           3,000     2%

To try and summarize:

I am trying to add another column of information to the existing table Nominations, and want to prevent the user from adding the same information multiple times for a given distinct group of Date | Vessel Name.

Am a bit confused as to how I would accomplish this in AppSheet - do I need to create a new table Nominations_With_Quality in Google Sheets to house this new column? Or is there any way I can re-use my existing table Nominations

0 4 1,182
4 REPLIES 4
Top Labels in this Space