29.10.2014 Views

Extracting data from the Synergetic database

Extracting data from the Synergetic database

Extracting data from the Synergetic database

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Common duplication problems<br />

<strong>Extracting</strong> <strong>data</strong> <strong>from</strong> <strong>the</strong> <strong>Synergetic</strong> <strong>data</strong>base<br />

Example 2<br />

Ano<strong>the</strong>r cause of duplication in a student contact query comes <strong>from</strong> <strong>the</strong> selection of any student fields.<br />

For example, you want to mail out one letter to <strong>the</strong> parents of students, regardless of whe<strong>the</strong>r <strong>the</strong>y<br />

have multiple siblings at <strong>the</strong> school. You also decide that you want to sort by YearLevel so you use<br />

this field as well.<br />

To adjust <strong>the</strong> query to avoid duplications because siblings may be in different year levels, you need to<br />

add <strong>the</strong>:<br />

• YearLevel field to <strong>the</strong> query<br />

• key word DISTINCT.<br />

Query with correction<br />

SELECT DISTINCT StudentContactMailName, StudentContactAddressComma, YearLevel<br />

FROM vStudentContactAddress<br />

WHERE StudentContactNormalMailFlag = 1 AND<br />

CurrentSemesterOnlyFlag = 1<br />

Returns<br />

ContactMailName ContactAddress YearLevel<br />

Mr Joe Black 15 Green St, MT WAVERLEY VIC 3149 5<br />

Mr Joe Black 15 Green St, MT WAVERLEY VIC 3149 10<br />

Version 60 Page 6-39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!