what is the {end time} for {Andhra Pradesh} has {capital} as {Hyderabad} ?
On what date did Andhra Pradesh in Hyderabad?
When was Andhra Pradesh in Hyderabad?
SELECT ?h WHERE { resource:Andhra_Pradesh property:capital ?e . ?e property:end_time ?h . ?e property:capital resource:Hyderabad }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q1159> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P36> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q1361> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q1159 p:P36 ?s . ?s ps:P36 wd:Q1361 . ?s pq:P582 ?value}