[Lazarus] Cross Platform SQL Client/Editor

Anthony Walter sysrpl at gmail.com
Sun Jan 3 16:20:37 CET 2016


Michael,

Regarding select into, it is needed because many times you select into in
order to create a table without needing to define it. This is especially
useful and perhaps almost necessary when creating temporary tables to
cache/persists a result for a session. When I do work processing huge
volumes of medial database records looking for pill mill facilities I need
to use these kinds of intermediate queries to filter billions of records
down to a manageable size.

Example:

select
  p.pracitioner_id,
  h.drug_code,
  i.icd_code,
  min(h.visit_date) [min_visit_date],
  count(*) [visit_count]
into
  #prescriptions
from
  hcfa h
  join icd10 i on i.icd_code = h.icd_code
  join pracititioner p on p.pracitioner_id = h.pracitioner_id
  join pracititioner_credentials pc on pc.pracititioner_id = p.pracititioner
where
  h.visit_date between '2015-01-01' and '2015-12-31 11:59:59 AM'
  and pc.certification = 'MD'
group by
  p.pracitioner_id,
  h.drug_code,
  i.icd_code
having
  count(*) > 3;

-- #prescriptions columns might actually be quite a bit more in
number/variety
-- reuse #prescriptions to check for other similar activity in the paste
-- when done #prescriptions is dropped

Now regarding an execute script window which allows for multiple blocks of
SQL to be execute and multiple result sets, this is what I and probably
everyone else I have ever worked with would need. When I create a temp
table like #prescriptions (which is one of the things everyone in
healthcare coverage IT development needs to do 10x daily) I do it in steps.
First I might start be creating a temp table out of the claims tables (hcfa
is outpatient claims). Then I check a portion of the temp table to make
sure the data looks right. Next I use the temp table to pull information
from the archives tables, and compare the results usually with sections of
multiple dataset return.

This is all standard stuff and it's not entirely limited to healthcare
database work. Healthcare IT developers are certainly the busiest when it
comes to checking records for practitioners or clients looking for new ways
to abuse the system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160103/9007c351/attachment-0003.html>


More information about the Lazarus mailing list