didijaba
Well-known Member
- Joined
- Nov 26, 2006
- Messages
- 511
Hi, I need help with creating SQL query. Thanks for any help you provide.
I have table with not fully filled with matching values. For example in column Name there is #1487, but if you offset to column Financial status, you will see that only first value is filled, other are not. What I want is to have SQL quary to create "full" table where empty cells are filled with matching values.
I know how to do it using formulas and VBA, but SQL is 10x faster, and I have large data set that is changing.
Here are links I use for implementing SQL
The Analyst Cave | Excel, analytics, programming and more
<style type="text/css">
table.tableizer-table {
border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #ccc;
}
.tableizer-table th {
background-color: #104E8B;
color: #FFF;
font-weight: bold;
}
</style><table class="tableizer-table">
<tr class="tableizer-firstrow"><th>Name</th><th>Created at</th><th>Financial Status</th><th>Payment Type</th><th>Lineitem quantity</th><th>Product code</th><th>Customer ID</th><th>Billing City</th><th>Billing Zip</th><th>Billing Province</th><th>Billing Country</th></tr>
<tr><td>#1486</td><td>1/2/2015 13:36</td><td>unpaid</td><td> </td><td>1</td><td>A01</td><td>285737</td><td>Tucker</td><td>30084</td><td>GA</td><td>US</td></tr>
<tr><td>#1487</td><td>1/2/2015 17:39</td><td>unpaid</td><td> </td><td>1</td><td>A02</td><td>285775</td><td>Borger</td><td>79007</td><td>TX</td><td>US</td></tr>
<tr><td>#1487</td><td>1/2/2015 17:39</td><td> </td><td> </td><td>1</td><td>A03</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>#1488</td><td>1/4/2015 0:45</td><td>paid</td><td>cash</td><td>1</td><td>B04</td><td>285970</td><td>BEVERLY HILLS</td><td>90211</td><td>CA</td><td>US</td></tr>
<tr><td>#1488</td><td>1/4/2015 0:45</td><td> </td><td> </td><td>1</td><td>B05</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>#1489</td><td>1/5/2015 14:44</td><td>paid</td><td>credit</td><td>1</td><td>A02</td><td>286155</td><td>New York</td><td>10014</td><td>NY</td><td>US</td></tr>
<tr><td>#1489</td><td>1/5/2015 14:44</td><td> </td><td> </td><td>1</td><td>A03</td><td> </td><td> </td><td> </td><td> </td><td></td></tr>
</table>
I have table with not fully filled with matching values. For example in column Name there is #1487, but if you offset to column Financial status, you will see that only first value is filled, other are not. What I want is to have SQL quary to create "full" table where empty cells are filled with matching values.
I know how to do it using formulas and VBA, but SQL is 10x faster, and I have large data set that is changing.
Here are links I use for implementing SQL
The Analyst Cave | Excel, analytics, programming and more
<style type="text/css">
table.tableizer-table {
border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #ccc;
}
.tableizer-table th {
background-color: #104E8B;
color: #FFF;
font-weight: bold;
}
</style><table class="tableizer-table">
<tr class="tableizer-firstrow"><th>Name</th><th>Created at</th><th>Financial Status</th><th>Payment Type</th><th>Lineitem quantity</th><th>Product code</th><th>Customer ID</th><th>Billing City</th><th>Billing Zip</th><th>Billing Province</th><th>Billing Country</th></tr>
<tr><td>#1486</td><td>1/2/2015 13:36</td><td>unpaid</td><td> </td><td>1</td><td>A01</td><td>285737</td><td>Tucker</td><td>30084</td><td>GA</td><td>US</td></tr>
<tr><td>#1487</td><td>1/2/2015 17:39</td><td>unpaid</td><td> </td><td>1</td><td>A02</td><td>285775</td><td>Borger</td><td>79007</td><td>TX</td><td>US</td></tr>
<tr><td>#1487</td><td>1/2/2015 17:39</td><td> </td><td> </td><td>1</td><td>A03</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>#1488</td><td>1/4/2015 0:45</td><td>paid</td><td>cash</td><td>1</td><td>B04</td><td>285970</td><td>BEVERLY HILLS</td><td>90211</td><td>CA</td><td>US</td></tr>
<tr><td>#1488</td><td>1/4/2015 0:45</td><td> </td><td> </td><td>1</td><td>B05</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>#1489</td><td>1/5/2015 14:44</td><td>paid</td><td>credit</td><td>1</td><td>A02</td><td>286155</td><td>New York</td><td>10014</td><td>NY</td><td>US</td></tr>
<tr><td>#1489</td><td>1/5/2015 14:44</td><td> </td><td> </td><td>1</td><td>A03</td><td> </td><td> </td><td> </td><td> </td><td></td></tr>
</table>