Hello database gods... Hope you can point me in the right direction.
I am using ms query within Excel 2003 on an external Excel file and am having problems writing the correct sql. The data file is c:\BDR\33activity with a named range "data" that tracks visits to customer sites by sales reps with the following data structure.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Location, Date,BDType, OPType, Cat, Rep <o></o>
<o> </o>
Data I would like is<o></o>
Location<o></o>
Last date with BDType activity="Business Development Visit"<o></o>
Last date with OPType activity<o></o>
Last date with BDType activity="Phone Call"<o></o>
<o> </o>
Output preferred for each Location <o></o>
Header<o></o>
LocationID-Last BD Visit - Last OP Visit - Last Phone Call<o></o>
Data<o></o>
2341, 09/09/2010, 11/07/2010, 09/09/2010<o></o>
Kind of new to the SQL thing but this is what I have so far from reading and surfing that gives me the first column of dates.<o></o>
<o> </o>
SELECT data.Location, Max(data.Date) AS 'Last Dev Call'<o></o>
FROM `C:\BDR\33activity`.data data<o></o>
WHERE (data.BDType='Business Development Visit')<o></o>
GROUP BY data.Location<o></o>
<o> </o>
I just cant get my head around how to get the second column in there without blowing it up. I know thats going to be much more complicated. so I would like to use this as a learning phase and if someone can show me how to do it this far I might be able to modify it to add more column or criteria to the col once I see the context..<o></o>
<o> </o>
Thanks for your patience with a newbie. Any help would be simply GREAT.<o></o>
I am using ms query within Excel 2003 on an external Excel file and am having problems writing the correct sql. The data file is c:\BDR\33activity with a named range "data" that tracks visits to customer sites by sales reps with the following data structure.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Location, Date,BDType, OPType, Cat, Rep <o></o>
<o> </o>
Data I would like is<o></o>
Location<o></o>
Last date with BDType activity="Business Development Visit"<o></o>
Last date with OPType activity<o></o>
Last date with BDType activity="Phone Call"<o></o>
<o> </o>
Output preferred for each Location <o></o>
Header<o></o>
LocationID-Last BD Visit - Last OP Visit - Last Phone Call<o></o>
Data<o></o>
2341, 09/09/2010, 11/07/2010, 09/09/2010<o></o>
Kind of new to the SQL thing but this is what I have so far from reading and surfing that gives me the first column of dates.<o></o>
<o> </o>
SELECT data.Location, Max(data.Date) AS 'Last Dev Call'<o></o>
FROM `C:\BDR\33activity`.data data<o></o>
WHERE (data.BDType='Business Development Visit')<o></o>
GROUP BY data.Location<o></o>
<o> </o>
I just cant get my head around how to get the second column in there without blowing it up. I know thats going to be much more complicated. so I would like to use this as a learning phase and if someone can show me how to do it this far I might be able to modify it to add more column or criteria to the col once I see the context..<o></o>
<o> </o>
Thanks for your patience with a newbie. Any help would be simply GREAT.<o></o>