SQL Server Developer Center > SQL Server Forums > Data Mining > Comparing a specification table to a results table
Ask a questionAsk a question
 

QuestionComparing a specification table to a results table

  • Tuesday, June 30, 2009 9:26 AMMartynCompton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I would like to know if there is a "simple" way to compare a specification table with a results tables contents.
    I have managed to do this in code by looping and capturing the name of the field for use in a repeating query but just maybe there is a simpler (and faster) way within the SQL language?
    I have stripped the table design down to it's bare bones below.
    The specification table has the fields - fieldName, Min, Max.  Each row in the table would have a fieldName and a min max for that fieldName
    The results table has the fields - Id, fieldNameA, fieldNameB, fieldNameC...etc. Each row has the sample id and then the results for the relevant fieldNameX.
    What I want to do is compare the results values against the specification table requirements.
    Any gurus with a suggestion on the most efficient way to do this?