vendredi 24 avril 2015

how to join 2 queries into 1

I am trying to join 2 of the following queries

select * from MapCountries where IndexName='SPX Index' and date(ModifiedDate)='2015-04-24';

select DRegion,DCountry,GICS1,GICS2,LRY,BBGLableValues from CompanyDetails where IndexName='SPX Index' and CompanyTicker='A UN' and date(ModifiedDate)='2015-04-24';

the second query is fired from the "while(reader.read())" of the first query. This is taking up a lot of CPU time. SO is there a way to join these 2 queries to reduce the CPU usage?

while (reader.Read())
{
    var regionModelTest = new RegionModelTest();
    ExtractCompanyDetails(Index, regionModelTest);
    ...
}

ExtractCompanyDetails(Index, regionModelTest)
{
   second query;
}

the CompanyTicker for the 2nd query comes from one of the fields of the first query.

Thank you for any help.

Aucun commentaire:

Enregistrer un commentaire