Using SQL Server, is it possible to create a one row result from two rows? See the following:
Sample Data:
+-----+-----------+----------------+------------+---------------------+
| PC | DriveName | AvailableSpace | TotalSpace | PostingDtime |
+-----+-----------+----------------+------------+---------------------+
| 111 | C:\ | 241 GB | 405 GB | 03/01/2024 23:00:00 |
| 111 | D:\ | 507 GB | 546 GB | 03/01/2024 23:00:00 |
| 111 | C:\ | 241 GB | 405 GB | 03/01/2024 0:00:00 |
| 111 | D:\ | 507 GB | 546 GB | 03/01/2024 0:00:00 |
Desired Results
+-----+-----------+----------------+------------+-----------+
| PC | DriveName | AvailableSpace | TotalSpace | DriveName |
+-----+-----------+----------------+------------+-----------+
| 111 | C:\ | 241 GB | 405 GB | D:\ |
| 111 | C:\ | 241 GB | 405 GB | D:\ |
+-----+-----------+----------------+------------+-----------+
I tried to use the pivot and cross join table as suggestion across the web, but I can't see similar answer from the web also.
DriveNamewithD:\in it, instead of two entries, one forC:\and one forD:\?