124
Mastering Queries 2007 By Jim Elder

Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Embed Size (px)

Citation preview

Page 1: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Mastering Queries2007

By

Jim Elder

Page 2: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Queries can be used for a number of reasons:

* To sort and filter to find information quickly.* To add or delete information by filtering a group of people to quickly make a change.* To quickly check information by a certain grouping.* To export information into another program.

Page 3: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

To make filtering the queries easier, review and print the Code Identification(Report under Reports|Print Data Files|Code Identification Report). This information gives you the letters that you need to place in the field value space.

Page 4: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Code Identification ReportWindows Youth Enrollment

Category ID Category• A Activity Leader• C Cloverbud./Mini• G General/Org Ldr• M Members• 0 Other• P Project Leader• R Resource Leader• S Special

Page 5: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Reserved Categories

• S - Special (Special interest/school enrichment only)

• O- Other (not counted in year end statistical)

Page 6: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Ethnic Code Ethnicity

• H Hispanic

• N Not Hispanic

Page 7: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Grade ID Grade Description• ‑1 None• 0 Kindergarten• 1 1 st Grade• 2 2nd Grade• 3 3rd Grade• 4 4th Grade• 5 5th Grade• 6 6th Grade• 7 7th Grade• 8 8th Grade• 9 9th Grade• 10 10th Grade• 11 11th Grade• 12 12th Grade• 13 Post H.S. Edu.• 14 Not in School• 15 Special

Page 8: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Group Type Code Group Type (Delivery Mode)• 1 4‑H Community Clubs• 2 4‑H In‑School Clubs• 3 4‑H After‑School Clubs• 4 Military 4‑H Clubs• 5 4‑H Special Interest/Short‑Term Programs• 6 4‑H Overnight Camping Programs• 7 4‑H Day Camping Programs• 8 4‑H School Enrichment Programs• 9 Individual Study/Mentoring/Family Programs• 10 School‑Age Child Care Education Programs• 11 Instructional TVvideo Programs• 12 Not a Youth Group Unit

Page 9: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Residence ID Residence

• 1 Farm

• 2 Rural

• 3 10,000 ‑ 50,000

• 4 50,000 ‑ Suburb

• 5 50,000 ‑ City

Page 10: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Status Code Status

• A Alumni

• I Inactive

• N New

• R Return

• T Terminate

Page 11: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Race Code Race• WHT White WHB White and Black• BLK Black or African American• WAI White and Al or AN• AMI American Indian (AI) or Alaska Native (AN)

• BAI Black and AI or AN• ASN Asian• WAS White and Asian• NHP Native Hawaiian or other Pacific Island• BAL Balance (Other Combination)

Page 12: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

True/False Codes

• T =True or

• F =False

Page 13: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• To filter by age: Fields – age / starting range-lowest age that you want to filter, ending range – upper age that you want to filter / OK, The list you generate will be all members that are between those ages.

Page 14: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 15: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• This member query would give you email address for all members, project advisors, activity leaders, general/organizational advisors and resource advisors. From here you can export the list to Excel.

Page 16: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Open the program, select file/ member query / file / filter - The member query box pops up, from here you select the field that you want to filter. The information that you are looking at includes all the member information for all members and advisors.

Page 17: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• To filter email addresses:• Fields – category, the status or field value would

be – A for activity advisor, C for Cloverbud member,

• G for General/Org Leader, M for Members, O for Other, P for Project Advisor, R for Resource

• Advisor, second filter would be Field – e-Mail / Category would be by range with the starting range being a and the ending range would be z

Page 18: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 19: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 20: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 21: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Creating Multiple queries at once.

• 1. Go to File|Member Query

• 2. File|Filter

• 3. In Fields All tab (on the left) Choose first filter option i.e. Status

• 4. In Status Field Value By Value tab (on the right) Type in N or R or T (n=new, r=

• returned, t= terminated)

Page 22: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 23: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Go back under Fields All tab and choose Second filter option Category

• 6. In Category Field Value By Value tab (on right) type in A or P or G or R (A= activity advisor, P= project advisor, G= general/organ. advisor, R= resource advisor

Page 24: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 25: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Click OK.

• 8. Your filter sequence is complete and has returned your results

Page 26: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Fields Field Value Results• Last Name Null

Members without a last name • First Name Null

Members without a first name

• Club Name Null Members without a club

Page 27: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Category• A = Activity Advisor List of all Activity Advisors• C = Cloverbud member List of all Cloverbud members

G = General / List of all General / Organizational Advisors

• M = Member List of all Members• O = Other List of all Others• P = Project Advisor List of all Project Advisors• R = Resource Advisor List of all Resource Advisor• S = Special List of all Special

Page 28: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Status

• A = Alumni List of all Alumni Members

• N = New List of all New Members

• R = Returned List of all Returned Members

• T = Terminate List of all Terminated Members

Page 29: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Address, City, Zip NullMembers without Address, City, Zip

• School NullMembers without School

Page 30: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Gender

• F = Female List of all Female advisors and members

• M = Male List of all Male advisors and members

Page 31: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Youth Leader

• True List of all Youth leaders

Birthday

• Null Members without birthday date.

Grade

• put in grade List of all in a specific grade

Page 32: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Age• put in age List of all that are a specific age

Ethnic• Null Members without Ethnic data

Race• Null Members without race data

Residence• Null Members without Residence data

Page 33: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Direct Volunteer

• True List of all Direct Volunteers

In Direct Volunteer

• True List of all In Direct Volunteers

Middle Manager

• True List of all Middle Managers

Page 34: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Phone

• Null Members without Phone #

Email

• By range (1 – z, or @) List of all members and advisors with email addresses

Page 35: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• NOTE: The Member Query contains live data. Before making mass changes to the database, ALWAYS make a backup of the current data files in the Youth Enrollment Data folder. This can save you much time if a mistake is made in the mass edit process. The file can be restored and the mass edit re-applied correctly. Backups are always your best insurance against database corruption.

Page 36: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Also: If you wish to export this information, you can go to Select all and go to File|Export|Ascii

Page 37: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 38: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Use the DualListForm to select the fieldsto be exported. From the Source (onleft) highlight the item i.e. MemberID andclick on the >. This puts the item underDestination (on right). Only the items on theleft are Exported. Note: If you wish to exportAll items can use the >> key to put all theitems on the right under Destination.

Page 39: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• A Save as box comes up. Note: where the file will be Saved or Browse where you want it saved. Also give it a FileName. It will be saved as a *.txt file. Click Save.

Page 40: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• If you wish to export the information as a dbase file go to Select all and File|Export|Dbase and a DualListForm window comes up. Choose your Fields you wish to export by moving them to the Destination side. I.e. Highlight the item from the Source (on left) i.e. MemberID and click on the >. This puts the item under the Destination (on right). Only items on the left are Exported.

Page 41: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• A Save as box comes up. Note: where the file will be Saved. Give it a File Name. It will be saved as a *.dbf file. Click Save.

Page 42: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Sample of Query 5th grade Females

• 1. Go to File|Member Query

• 2. File|Filter

• 3. In Fields All tab (left) Choose 1st filter option i.e. Status

• 4. In Status Field Value By Value tab (right) Type in N or R

• 5. In Fields All tab (left) Choose 2nd filter option i.e. Gender

Page 43: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 6. In Status Field Value By Value tab (right) Type in F

• 7. In Fields All tab (left) Choose 3rd filter option i.e. Grade

• 8. In Status Field Value By Value tab (right) Type in 5

• 9. By viewing the View Summary it verifies your filters:

Page 44: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 45: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Click OK in the Summary and OK in the filter. Your return filter sequence is complete and has returned your results:

Page 46: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 47: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Go to Select|Select all

• 12. You can choose mailing labels right from here by going to Action|Mailing Labels. Choose your parameters and Preview and/or Print your labels.

• 13. OR If you wish to export, go to File|Save As Dbase and save your file as shown before.

Page 48: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• To Further Filter after you had already created a filter

• 1. If you have created a filter and want to filter further. Simply go back to File|Filter and your current Filter will be there (As Searched tab).

• 2. Click on the Fields All tab and choose a field i.e. Category

Page 49: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 50: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Click on the Fields All tab and choose a field i.e. Category In the ClubID Field Value By Value type in M

• ***** Any field that is displayed on the Member Query Screen as a checkmark is considered a True/False field. Use the word True or a T to retrieve the

Page 51: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 52: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• ***** Any field that is displayed on the Member Query Screen as a checkmark is considered a True/False field. Use the word True or a T to retrieve the

Page 53: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 54: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Information from the file in the Field Value By Value tab as checked. Use the word False or a F to retrieve a blank

• Any field that displays on the query screen as a checkmark is considered a True/False field. Highlight the field in the Fields window. · In the Field Value (By Value), type the word True or the letter T to retrieve a record containing a checkmark. Type False or F to retrieve records that do not have a checkmark.

• Returns the output

Page 55: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 56: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 57: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• The use of Null• Null = means blank or nothing in computer

language. Therefore, to find fields that are blank in many cases you need to use the Field value of Null.

• 1. Go to File|Member Query• 2. File|Filter• 3. Checking your files for a blank is ordered by

choosing under Field All tab (on left) Grade, in FieldValue Grade By Value tab of Null

Page 58: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 59: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Returns results

Page 60: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 61: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Filtering By Range• In filtering you can also choose a range to target.• 4. Go to File|Member Query• 5. File|Filter• 6. IF you want to see how many members/leaders

were in 4H for 3-5 years. Choose the Year4H Field in AllFields tab (on left). Year4H Starting Range 3, Ending Range 5, By Range tab.

• 7. Returns results

Page 62: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 63: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Sample of Query 5th grade Females – Can Add & Modify this sample

• 1. Go to File|Member Query• 2. File|Filter• 3. In Fields All tab (left) Choose 1st filter option i.e. Status• 4. In Status Field Value By Value tab (right) Type in N or R• 5. In Fields All tab (left) Choose 2nd filter option i.e. Gender• 6. In Status Field Value By Value tab (right) Type in F• 7. In Fields All tab (left) Choose 3rd filter option i.e. Grade• 8. In Status Field Value By Value tab (right) Type in 5• 9. By viewing the View Summary it verifies your filters:

Page 64: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 65: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Click OK in the Summary and OK in the filter. Your return filter sequence

• is complete and has returned your results:

Page 66: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 67: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Go to Select|Select all• 12. You can choose mailing labels right from here by

going to Action|Mailing Labels. Choose your parameters and Preview and/or Print your labels.

• 13. OR If you wish to export, go to File|Save As Dbase and save your file as shown before.

• To open files in Excel you can simply open the file and it sets the headers and columns up automatically. Just browse to find your *.dbf file and it returns your database.

• To open files in Excel you can simply open the file and it sets the headers and columns up automatically. Just browse to find your *.dbf file and it returns your database.

Page 68: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Using Filters in Queries

• ¨ New and Return Members only:

• 1. Choose File|Member

• Query, then choose File|Filter.

• 2. Highlight Category on the left, and enter (by value) “m” on the right.

• 3. Highlight Status on the left and enter “N or R” on the right. (No quotation marks).

Page 69: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 70: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 4. Click on the View Summary button, and see if your Search Summary looks like the one below. If it does, click OK and OK. If not, click OK and go back to make changes.

• 5. When you have it right, and are back on the Member Query screen, scroll through your records to assure yourself that only New and Return Members are listed on the screen.

Page 71: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 72: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Note: upper/lower case generally doesn’t matter, you can use either.

• ¨ All Leader Types (new & return only):• 1. Category = a or p or g or r• 2. Status = N or R• ¨ Inactives (members & leaders only):• 1. Category = a or p or g or r or m• 2. Status = I• ¨ Terminated members• 1. Category = m• 2. Status = T• ¨ High School Girls• 1. Gender = f• 2. Grade (by range) Starting Range = 9, Ending Range = 12

Page 73: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• ¨ Anyone who has an email address

• 1. Email = @

• 2. “Search type” must be set to “Partial Match Anywhere”.

Page 74: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Combining filtersYou can use as many conditions in your filter as you want

—I listed some simple ones above, thattake only 1 or 2 conditions. Below is an example of

combining some of those

• ¨ High school girls who have re -enrolled, and who have email addresses:

• 1. Email = @ (“Search type” must be set to “Partial Match Anywhere”.)

• 2. Gender = f• 3. Grade (by range) Starting Range = 9, Ending

Range = 12• 4. Category = m• 5. Status = N or R

Page 75: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Printing mailing labels through Member Query

• You may wish to print mailing labels for only a select group of kids, or for only one kid. There is no way to sort these through the regular Mailing Labels option, since the conditions could be pretty much random. Perhaps you want to print labels for all members who attend a specific school, to send a note informing them of an upcoming program… or to a group of girls only.

• Directions: Choose File|Member Query. The first screen to appear will be similar to the one at right.

Page 76: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 77: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• To print labels for all members who attend Webster City school, choose File|Filter, and fill in the information as shown on the screen print at right. Click OK when done. Now your Member Query list is shorter, and if you scroll over, you can see that everyone listed is a student at Webster City.

Page 78: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 79: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• HOWEVER, there are only ten of them, which doesn’t sound right to me. So go back into File|Filter, and change “web” to “w”. Now there are 155, which sounds right, BUT notice it also includes “Wright Co.” – there’s an object lesson here in consistent naming conventions…

Page 80: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

•Oh, shoot, you forgot that only 11th and 12th graders could come to this program. Not to worry. Choose File|Filter again, and set the following condition:

Page 81: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 82: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Ah, but you ask, won't that override the school filter--now I'll see all 11th and 12th graders in the whole county? Let's check. Click on the View Summary button at the bottom of the screen. All things being equal, you will see a screen like this one. What it tells you is that it's only going to find records that match both conditions. Click OK, and OK again.

Page 83: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 84: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Now the list of members is considerably shorter. In fact, there are only 24 listed. They are all 11th and 12th grade students at Webster City school. Since this appears to be the group we were looking for, we'll print mailing labels.

Page 85: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• The first and most important step is to select which members you want to print labels for. Just because they're listed on screen doesn’t mean that anything is going to happen to them. Choose Select|Select All in this case, because these are all "right". If you want to omit one, hold down your CONTROL key and click on that record. It will become "unhighlighted". Then be sure to move your “left edge triangle” by pressing one of the up or down arrow keys on your keyboard, until it is opposite a highlighted record.

Page 86: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• When all members are correctly highlighted, choose Action|Mailing Labels. Your options are much more limited on this screen than on the regular Mailing Labels screen. In fact, you will notice that it is not possible to print "One Per Family" by this method. The Setup button at the bottom allows you to change font/size/margins, etc. Preview, and you will see that there will be labels printed for each of the members who were selected from the Member Query screen. Cool, huh?

Page 87: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• To print a label for only one person or a few random youth, first choose File|Member Query. (If you didn't exit from Member Query, you would need to choose Reset Query.) Nonetheless, members are easier to find by name, so in the Index box in the upper right corner, choose Name. Highlight Danielle Bernard, and then hold down the CONTROL key while you click on Kassie Clark. Both should be highlighted. Now you can choose Action|Mailing Labels, and labels for only these two members will be printed/previewed. Cool again, huh?

Page 88: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 89: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Project Query

Page 90: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• When the project query is initially opened, the edit feature under the Action Menu is locked. This prevents unintentional editing of the data. To activate the edit options, go Options|Edit. Click on Edit Mode. Now go to the Action Menu and the edit options are available for use.

Page 91: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• These options include delete projects, set projects complete, set projects active, mark youth leaders, mark score, charge project ID, change club code, and add associated activities to the activity file. Data from the project query can be exported to various file structures and also be used to create email lists and mail labels.

Page 92: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Activity Query

Page 93: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Options in the activity query are similar to the project query. The actions that can be implemented include deleting activities, changing club codes, and adding member certification records for associated activities.

Page 94: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Award Query

• The award query accesses the member award file and allows records to be added and deleted.

Page 95: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

SQL Definitions

• SELECT Statement

• SELECT [Distinct] * | column_list

• FROM table_reference

• [WHERE table and/or fields and values]

• [ORDER by order_list]

• [GROUP by group_list]

• [HAVING having_condition]

Page 96: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Description

• Use the SELECT statement to Retrieve a single row or part of a row, from a table Retrieve multiple rows or parts of rows, from a table Retrieve information from a join of two or more tables

Page 97: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• The SELECT clause defines the list of items returned by the SELECT statement.

• It is composed of: table columns(field names), literal values, and these values modified by functions. Use an * to retrieve values from all columns.

Page 98: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Field names for the SELECT clause may come from more than one table, but can only come from those tables listed in the FROM clause.

Page 99: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Youth Enrollment Data

Youth2A Member/Leader File Youth2A1 Utility: Grade Codes Youth2B Parent File Youth2BL Member/Parent LinkYouth2C Project Codes File Youth2C1 Utility: Program Youth2C2 Utility: Initiative Codes

Page 100: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Youth2C3 Utility: Federal Curriculum Codes Youth2D Member Projects Youth2E Award Codes File Youth2F Member Awards Youth2G Activity Codes File Youth2H Member Activities Youth2I County Information File Youth2J Initiative Codes File Youth2L Training File Youth2M Volunteer Group File

Page 101: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Youth2M1 Utility: Type CodesYouth2N Youth Group File Youth2N1 Utility: Participation Codes Youth2U1 Utility: Ethnic Codes Youth2U2 Utility: Residence Codes Youth2U3 Utility: Member Category Codes Youth2U4 Utility: Member Status Codes Youth2U5 Utility: Program Source Codes Youth2V Master Member Certificate Codes Youth2W Member Certificate Codes Youth2X Club Codes File Youth2XL Club Code Link Youth2Y Project Literature File Z5lite Zip Code Lookup File

Page 102: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• The FROM clause identifies the table(s) from which data is retrieved.

• Sample - data from two fields in a table:

• SELECT FirstName, LastName

• FROM Youth2a

Page 103: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Use DISTINCT to limit the retrieved data to only distinct values needed in the table.

• Sample:SELECT Distinct Youth2a.MemberID,Youth2a.FirstName, Youth2a.LastName,Youth2d.ProjectIDFROM “Youth2a.db” Youth2aInner Join “Youth2d.db” Youth2dOn (Youth2a.MemberID = Youth2d.MemberID)Where Youth2d.ProjectID = “200”

Page 104: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

SQL Select Statements - Creating Queries

and Microsoft Excel Charts

• 1.) Under File|Create & View Query, create the actual Select statement query in the Create and View Query located under the File menu. (My query will select member ID's and their category ID.) Click the Run Query button. The selected records will display in the bottom grid.

Page 105: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 106: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 2.) Click the Export To ASCII button to save your query results to a file on your computer.

• Choose the fields from your query that you wish to export. (The default extension for the file will be .TXT - DO NOT change this extension. You may change the file name from Untitled.) Click the Save button.

Page 107: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 3.) Close out of Windows Youth Enrollment. Open up Microsoft Excel. Select All files (*.*) under the Files of Type drop down menu. Use the browse option in the Look In field to select the location of the file saved previously in Step #2. Highlight the file and click Open.

Page 108: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 109: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 4.) The Text Import Wizard appears. This wizard will convert your .TXT file to Excel.

• The first step is already selected for you. Use the default setting of Delimited.

• Click the Next button.

Page 110: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 111: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 5.) Under Step #2 of the Wizard, go to the Delimiters group box and check Comma.

• This is the format of the file you have saved. Leave the default Tab check box checked. A vertical line should now separate your data. Click the Next button.

Page 112: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 113: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• 6.) In Step #3, click the Finish button. Excel has finished importing the file.

Page 114: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 115: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Sample SQLs

Page 116: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

SQL shows joining tables and showing specific projects, grade, for members and

others

Select Distinct Youth2a.MemberID, Youth2d.ProjectID, Youth2a.FirstName,

Youth2a.LastName, Youth2a.Grade, Youth2a.Status, Youth2a.Category

From “Youth2a.db” Youth2aInner Join “Youth2d.db” Youth2dOn (Youth2a.MemberID = Youth2d.MemberID)Inner Join “Youth2h” Youth2hOn (Youth2a.MemberID = Youth2h.MemberID)Where Youth2d.ProjectID IN (‘BCA’, ‘GCB’)And Youth2a.Category IN (“M”, “O”)And Youth2a.Status IN (“N”, “R”)And Youth2h.ActivityID NOT IN (‘100’, ‘110’)Order by Youth2a.LastName, Youth2a.FirstName

Page 117: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

This shows joining a few tables on members, with parent and project information.

Select Youth2a.MemberID, Youth2d.ProjectID, Youth2c.”Desc”,Youth2a.FirstName, Youth2a.LastName, Youth2b.FirstName,

Youth2b.LastName,Youth2a.Age, Youth2a.ClubIDFrom “Youth2a.db” Youth2aInner Join “Youth2d.db” Youth2don (Youth2a.MemberID = Youth2d.MemberID)Inner Join “Youth2bl.db” Youth2blon (Youth2d.MemberID = Youth2bl.MemberID)Inner Join “Youth2b.db” Youth2bon (Youth2bl.ParentID = Youth2b.ParentID)Inner Join “Youth2c.db” Youth2con (Youth2d.ProjectID = Youth2c.ProjectID)Order by ProjectID, Youth2a.LastName, Youth2a.FirstName

Page 118: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete
Page 119: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

First query is to create a list of females between the ages of 8-15 in projects 139 & 140. In the Blue Ribbon Youth Enrollment program go to file, view and create query, delete the select and from the middle of the white box and copy and paste this SQL and select run query. This query will list females ages 8-15 in projects 139 & 140.

Page 120: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• Select Distinct Youth.firstname, Youth.lastname, Youth.address, Youth.city, Youth.state, Youth.zip From "Youth2a.db" Youth Inner Join "Youth2d.db" Youthproj On (Youth.MemberID = Youthproj.MemberID) Where ((Youthproj.projectId  = "139" or Youthproj.projectId = "140") And (Youth.Age >= "8" And Youth.Age <="13") And Youth.Category = "M" And Youth.Status = "R" And Youth.sex = "F") Order by Youth.Lastname, Youth.Firstname

Page 121: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

• We are interested in obtaining a list of 4-H members that are taking project 226. The information that we need is first name, last name and club name. We want to export the data to Excel so that we can use it to keep tract of rabbit members.

Page 122: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Formula that needs copied if using one project:

Select Youth.firstname, youth.lastname,club.clubnameFrom "Youth2d.db" ProjectInner Join "Youth2a.db" Youth            On (Project.MemberID = Youth.MemberID)Inner Join "Youth2x.db" Club        On (Project.clubID = club.ClubID)Where ((Project.ProjectID = "226") and ("Youth2d.db"."Active" = true) and (Youth.Category = "M")) order by Youth.lastname, Youth.firstname

Page 123: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Use this formula if you want to use two projects:

Select Youth.firstname, youth.lastname,club.clubnameFrom "Youth2d.db" ProjectInner Join "Youth2a.db" Youth            On (Project.MemberID = Youth.MemberID)Inner Join "Youth2x.db" Club        On (Project.clubID = club.ClubID)Where (((Project.ProjectID = "225") or  (Project.ProjectID = “227”)) and ("Youth2d.db"."Active" = true) and (Youth.Category = "M")) order by Youth.lastname, Youth.firstname

Page 124: Mastering Queries 2007 By Jim Elder. Queries can be used for a number of reasons: * To sort and filter to find information quickly. * To add or delete

Any Questions?