cjbrown815
IS-IT--Management
Hello, I have a fixed date that I need to make today minus 3 years each time it is ran. Here is the current query. I am using excel 2007 Microsoft query tool to return the data in a spreadsheet for plotting
Thanks
SELECT SAMPLE.SAMPLE_ID, SAMPLE.SAMPLE_STATUS, SAMPLE.SUBMITTER, SAMPLE.SAMPLE_TYPE,SAMPLE.TEXT3, SAMPLE.TEXT5,SAMPLE.DATE3,
SAMPLE.REMARKS, SAMPLE.LOT, SAMPLE.PRODUCT_LOT,
SAMPLETYPE.ST_TYP, SAMPLETYPE.ST_ID, SAMPLETYPE.ST_NAME,
SAMPLETYPE.ST_DESC,
SAMPLEPARAM.PA_NAME,
SAMPLEPARAM.TRESULT, SAMPLEPARAM.NRESULT, SAMPLEPARAM.SRESULT, SAMPLEPARAM.ORESULT,
SAMPLEPARAM.SAMPLEPARAM_ID
FROM LIMSProd.dbo.SAMPLE SAMPLE, LIMSProd.dbo.SAMPLEPARAM SAMPLEPARAM, LIMSProd.dbo.SAMPLETYPE SAMPLETYPE
WHERE SAMPLE.SAMPLE_ID = SAMPLEPARAM.SAMPLE_ID AND
SAMPLEPARAM.ST_N = SAMPLETYPE.ST_N AND
SAMPLEPARAM.ST_VERS = SAMPLETYPE.ST_VERS AND
((SAMPLE.SAMPLE_TYPE Like 'WKLY_%') AND
(SAMPLE.DATE3>={ts '2008-01-04 00:00:00'} And
SAMPLE.DATE3<={ts '2010-08-25 00:00:00'}) AND
(SAMPLEPARAM.PRINT_FLAG=1))
ORDER BY SAMPLE.DATE3, SAMPLE.SAMPLE_TYPE
-CJ
SQL2005// CRXIr2// XP Pro
"Progress lies not in enhancing what is, but in advancing toward what will be"
-KHALIL GIBRAN 1883-1931
Thanks
SELECT SAMPLE.SAMPLE_ID, SAMPLE.SAMPLE_STATUS, SAMPLE.SUBMITTER, SAMPLE.SAMPLE_TYPE,SAMPLE.TEXT3, SAMPLE.TEXT5,SAMPLE.DATE3,
SAMPLE.REMARKS, SAMPLE.LOT, SAMPLE.PRODUCT_LOT,
SAMPLETYPE.ST_TYP, SAMPLETYPE.ST_ID, SAMPLETYPE.ST_NAME,
SAMPLETYPE.ST_DESC,
SAMPLEPARAM.PA_NAME,
SAMPLEPARAM.TRESULT, SAMPLEPARAM.NRESULT, SAMPLEPARAM.SRESULT, SAMPLEPARAM.ORESULT,
SAMPLEPARAM.SAMPLEPARAM_ID
FROM LIMSProd.dbo.SAMPLE SAMPLE, LIMSProd.dbo.SAMPLEPARAM SAMPLEPARAM, LIMSProd.dbo.SAMPLETYPE SAMPLETYPE
WHERE SAMPLE.SAMPLE_ID = SAMPLEPARAM.SAMPLE_ID AND
SAMPLEPARAM.ST_N = SAMPLETYPE.ST_N AND
SAMPLEPARAM.ST_VERS = SAMPLETYPE.ST_VERS AND
((SAMPLE.SAMPLE_TYPE Like 'WKLY_%') AND
(SAMPLE.DATE3>={ts '2008-01-04 00:00:00'} And
SAMPLE.DATE3<={ts '2010-08-25 00:00:00'}) AND
(SAMPLEPARAM.PRINT_FLAG=1))
ORDER BY SAMPLE.DATE3, SAMPLE.SAMPLE_TYPE
-CJ
SQL2005// CRXIr2// XP Pro
"Progress lies not in enhancing what is, but in advancing toward what will be"
-KHALIL GIBRAN 1883-1931