Subject | Need some help with a query |
---|---|
Author | Marcin Bury |
Post date | 2012-11-20T15:19:55Z |
Hello All
Let's say that I have a table containing:
Machine_Name varchar(20)
Config_Name varchar(20)
Work_Date date
The data for one machine may look like this:
Machine_1, Config_1, 01.11.2012
Machine_1, Config_1, 02.11.2012
Machine_1, Config_1, 03.11.2012
Machine_1, New_Config, 04.11.2012 <- we have set up a new configuration
Machine_1, New_Config, 05.11.2012
Machine_1, Config_1, 06.11.2012 <- back to old config
Machine_1, Conifg_1, 07.11.2012
I'd like to create a query that returns the 'history' of configurations
for one machine, like this:
Config_Name, Date_From, Date_To
Config_1, 01.11.2012, 03.11.2012
New_Config, 04.11.2012, 05.11.2012
Config_1, 06.11.2012, 07.11.2012
Is it possible without iterating each entry for Machine_1 ?
Thank you in advance
Marcin
Let's say that I have a table containing:
Machine_Name varchar(20)
Config_Name varchar(20)
Work_Date date
The data for one machine may look like this:
Machine_1, Config_1, 01.11.2012
Machine_1, Config_1, 02.11.2012
Machine_1, Config_1, 03.11.2012
Machine_1, New_Config, 04.11.2012 <- we have set up a new configuration
Machine_1, New_Config, 05.11.2012
Machine_1, Config_1, 06.11.2012 <- back to old config
Machine_1, Conifg_1, 07.11.2012
I'd like to create a query that returns the 'history' of configurations
for one machine, like this:
Config_Name, Date_From, Date_To
Config_1, 01.11.2012, 03.11.2012
New_Config, 04.11.2012, 05.11.2012
Config_1, 06.11.2012, 07.11.2012
Is it possible without iterating each entry for Machine_1 ?
Thank you in advance
Marcin