---
title: "How to filter data by Prospect"
canonical: "https://servicedesk.maxgeo.com/space/MAXGEO/1053917200/How+to+filter+data+by+Prospect"
format: markdown
---
A VIEW will need to be created in SQL first, using field Prospect aliased as “Domain” (any filters set up for QAQCr need to aliased to exact field name of “Domain”).

The view needs to be a SQL join between the collar and sample tables. Please see the script below:

```sql
CREATE VIEW [dbo].[tblVWDHProspect_QAQCr]
AS
SELECT dbo.tblDHSamp.DataSet, dbo.tblDHSamp.Hole_ID, dbo.tblDHSamp.SampleID, dbo.tblDHSamp.Depth_From, dbo.tblDHSamp.Depth_To, dbo.tblDHSamp.Sample_Type, dbo.tblDHColl.Prospect AS Domain
FROM dbo.tblDHSamp INNER JOIN
dbo.tblDHColl ON dbo.tblDHSamp.DataSet = dbo.tblDHColl.DataSet AND dbo.tblDHSamp.Hole_ID = dbo.tblDHColl.Hole_ID
GO
```

The view does not need to be registered in DataShed.

Once the filter is created, it then needs to be set up in QAQCr and then it can be used in your QAQCr selection - see screenshots below:

1. Set up filter

![image](media://6fe3be0d-5068-4d3e-8bc5-ae48536f4263)

2. Use filter:

![image](media://d00c06cb-3e08-44fd-bcef-60f1f9837210)

3. Apply filter (can select, all prospects, a single prospect or as many as wanted - if select multiple Prospects they will plot as different colours on the charts):

![image](media://921ade28-1b0e-415f-ae30-554ff42f7393)

> ⚠️ DB Modification
> ⚠️ 
> ⚠️ Before any change is made to a user database (or system), maxgeo recommends competent staff should follow all standard database change management practices and never make untested changes to a production database.  
> ⚠️ Change, test and document all modifications on a test copy of your database to ensure results are as expected before implementing them on your live database. Always ensure a full backup is available in case rollback is required and follow all company change management procedures and practices.