Extracting data from the Synergetic database
Extracting data from the Synergetic database
Extracting data from the Synergetic database
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Extracting</strong> <strong>data</strong> <strong>from</strong> <strong>the</strong> <strong>Synergetic</strong> <strong>data</strong>base<br />
Advanced Microsoft Query and SQL examples<br />
Example 4 - Selecting records in Microsoft Query on <strong>the</strong> basis of date fields<br />
Select enquiries in <strong>the</strong> last 7 days:<br />
Query<br />
SELECT<br />
vEnquiryContactAddress.EnquiryID, vEnquiryContactAddress.EnquiryDate<br />
FROM vEnquiryContactAddress<br />
WHERE<br />
{fn TIMESTAMPDIFF(SQL_TSI_DAY, {fn CURDATE()},<br />
vEnquiryContactAddress.EnquiryDate)} > -6<br />
Points to note:<br />
• The –6 means 'select all enquiries for today plus <strong>the</strong> last 7 days'. Change <strong>the</strong> –6 to 0 for<br />
TODAY only. You can change to any o<strong>the</strong>r value to select enquiries <strong>from</strong> that many days<br />
ago. You MUST enter <strong>the</strong> number of days with <strong>the</strong> minus sign (means PRIOR to today).<br />
Page 6-68 Version 60