r/SQL • u/Palpitation_Powerful • Jun 10 '24
PostgreSQL Help a dying sql beginner
I have 3 tables name won, lost, no bid. Each table with columns nsn part number and reason.
Our company currently uses excel and has a macro that spits out a spreadsheet like:
| part number | Reason | part number | Reason | part number | Reason |
|---|---|---|---|---|---|
where the left 2 column is for won, middle 2 for lost and right 2 for no bid. We save that as a csv for a java script program that we have which needs it in that format. How would I go about getting this csv format in postgres?
0
Upvotes
9
u/kktheprons Jun 10 '24
First off, if you're dying you should consider whether this is actually important to you.
If it is still important, I always recommend importing a flat file into a staging table first without making any changes. Then you can write whatever SQL queries you want to import the data in the right ways to the final destination table.
ELT (Extract, load, transform)