MySQL Inner Join on Same Table
Posted on 2014-02-20
I have the following table structure.
DeviceNumber - int,
Volume - double,
Timestamp - datetime
I'd like to create a query that produces the difference of two volumes in the same row. The result of the query should provide
VolumeOfId#1, VolumeofID#2, VolumeofID#3, VolumeofID#4, VolumeofID#5, VolumeofID#6, Timestamp
The six ID's can be hard quoted in the query for this example.
I'm familar with Joins but unsure how to execute a join on the same table, and more so on how to produce the six column result.