Helpful Queries

From PRAMS Plus Wiki
Revision as of 22:59, 26 February 2020 by Cody Gallagher (talk | contribs)
Jump to navigation Jump to search

This page contains queries that have been found useful for Prams users.


QueryX2

To use one of the queries below, copy all the data and paste into QueryX2, change the parameters, then run the query.

If you are having difficulties running a query or need a new query built, call Prams at 303-904-6855.

Query 1
#TOTAL 5 6
----------------------------
--Change these parameters'
#DEFINE :AGR='The Lease #'
#DEFINE :PDT='mm/dd/yyyy'
----------------------------
SELECT s.user_ref, p.name,md.prod_date, md.start_bal, md.end_bal
  FROM md_product md
  LEFT JOIN site s ON md.site_id = s.site_id
  LEFT JOIN product p On md.product_id = p.product_id

WHERE md.product_id IN
	(SELECT product_id FROM product
		WHERE site_id = md.site_id AND [type] = 'OIL' AND name = 'OIL' )
   		AND s.[site_type] IN ('WEL')
   		AND md.prod_date >= :PDT
      AND s.site_id IN (SELECT site_id FROM site_agree WHERE [value] = :AGR)

ORDER BY s.user_ref, prod_date
Result




Copyright © 2024 by PRAMS Plus LLC. All Rights Reserved.