title: Best way to convert gis data from one postgis table to another for simplification
body: <p>I have dumped a lot of shapefiles into a postgis database and will be using this for a GIS application through QGIS. Now, I have developed a data dictionary that is sensible and intuitive for the end user on the trimble gathering data. So this is how the initial table is generated, with end user on trimble being top priority. Now when I use this gathered data in qgis the attribute column that shows up for selected points on some feature classes are not very simplified. </p>
  
  <p>For example, we are a pipeline utility, and I have the trimble set up so that when they select a nominal pipe diameter, it gives options for different wall thicknesses based on that pipe size. This works well on the trimble, but then I get 8 or 9 blank values for every piece of pipe in the map. So if I select a 2" main, the attributes display the size, and wall thickness fields for every size from 3/4" to 10" but the only one that has a value is for the 2". What I would like to do, is create a new table that simplifies this, and then run the data from the table housing the trimble generated data, and dump it into the new table. This will not only require importing the data from one postgres table "Main" in the db "GIS" into a new table "Main" in my trial database, but will also require some code to search through columns a b c d etc. to find the one that that isn't null, and send it to the new table's Wall Thickness column.</p>
  
  <p>I have several properties, and several tables that have these problems, but I think if someone can help or at least point me in the right direction on this particular situation, I can do the rest of them. This is seriously the last step in my GIS build before we are ready to start rolling it out, and I would really appreciate if someone could help me clean this up a bit.</p>
  
  <p>I have pgadmin 4, qgis 2.18, some knowledge on SQL and can manipulate data from the command line, and I see that qgis has a built in python console that may be able to help. I know python a bit, and could probably get by if the best route is through it. Just a bit of information on myself to help you guys determine my best route. Thanks again!</p>
  
  <p>p.s. I have added pictures of my existing data structure for the "Main" feature in qgis, and a picture of the new table I'd like to populate for the "Main" feature in command line. <a href="https://imgur.com/a/bkUqS" rel="nofollow noreferrer">http://imgur.com/a/bkUqS</a></p>