Helpful Queries: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| Line 10: | Line 10: | ||
|- | |- | ||
|Query 1 | |Query 1 | ||
| | |<syntaxhighlight lang="SQL"> | ||
| | #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 | |||
</syntaxhighlight> | |||
|Result | |||
|- | |- | ||
|} | |} | ||
| Line 17: | Line 37: | ||
Copyright © {{CURRENTYEAR}} by PRAMS Plus LLC. All Rights Reserved. | Copyright © {{CURRENTYEAR}} by PRAMS Plus LLC. All Rights Reserved. | ||
Revision as of 14:59, 26 February 2020
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 © 2026 by PRAMS Plus LLC. All Rights Reserved.