Monday, July 2, 2012

Bunch 'O Queries


SELECT RETCTBL0_ETC_ID.ETC_ID, RETCTBL0_ETC_ID.ETC_NAME, RETCTBL0_ETC_ID_1.ETC_ID, RETCTBL0_ETC_ID_1.ETC_NAME, RETCMED0_ETC_MEDID.MEDID, RMIID1_MED.MED_MEDID_DESC
FROM (((RETCTBL0_ETC_ID INNER JOIN RETCSCH0_ETC_SEARCH ON RETCTBL0_ETC_ID.ETC_ID = RETCSCH0_ETC_SEARCH.ETC_SEARCH_ETC_ID) INNER JOIN RETCMED0_ETC_MEDID ON RETCSCH0_ETC_SEARCH.ETC_PRODUCT_RELATED_ETC_ID = RETCMED0_ETC_MEDID.ETC_ID) INNER JOIN RMIID1_MED ON RETCMED0_ETC_MEDID.MEDID = RMIID1_MED.MEDID) INNER JOIN RETCTBL0_ETC_ID AS RETCTBL0_ETC_ID_1 ON RETCMED0_ETC_MEDID.ETC_ID = RETCTBL0_ETC_ID_1.ETC_ID
WHERE (((RETCTBL0_ETC_ID.ETC_ID)=77))
ORDER BY RETCTBL0_ETC_ID.ETC_ID, RETCTBL0_ETC_ID_1.ETC_NAME, RMIID1_MED.MED_MEDID_DESC;

 select * from RETCMED0.MEDID
 SELECT RETCTBL0.ETC_ID,RETCTBL0.ETC_NAME,RETCMED0.MEDID,RMIID1.MED_MEDID_DESC from RETCTBL0

 select * from RETCTBL0 where etc_id=77
  select * from RETCTBL0 where etc_parent_etc_id = 77
  select * from RETCTBL0 where etc_parent_etc_id in (78,80,81,82)
  select * from RETCTBL0 where etc_ultimate_parent_etc_id = 1246
  select * from RETCSCH0 where etc_search_etc_id = 78
   select count(*) from RETCSCH0 where etc_search_etc_id = 78
  select * from rmiid1 where medid in (6273,6274,6275)
  select * from RETCMED0 inner join rmiid1 on retcmed0.medid = rmiid1.medid where ETC_ID = 3626
  select * from RETCMED0 where ETC_ID in (6273,6274,6275)
 select * from RETCTBL0 where etc_id=5904
 select * from rgcnseq4 where gcn_seqno = 94200
 SELECT RETCTBL0.ETC_ID, RETCTBL0.ETC_NAME, RETCTBL0_1.ETC_ID, RETCTBL0_1.ETC_NAME, RETCMED0.MEDID, RMIID1.MED_MEDID_DESC
FROM (
      (
        (RETCTBL0 INNER JOIN RETCSCH0 ON RETCTBL0.ETC_ID = RETCSCH0.ETC_SEARCH_ETC_ID) INNER JOIN RETCMED0 ON RETCSCH0.ETC_PRODUCT_RELATED_ETC_ID = RETCMED0.ETC_ID)
      INNER JOIN RMIID1 ON RETCMED0.MEDID = RMIID1.MEDID
     )
      INNER JOIN RETCTBL0 AS RETCTBL0_1 ON RETCMED0.ETC_ID = RETCTBL0_1.ETC_ID
WHERE (((RETCTBL0.ETC_ID)=77))
ORDER BY RETCTBL0.ETC_ID, RETCTBL0_1.ETC_NAME, RMIID1.MED_MEDID_DESC;

select * from RETCTBL0 INNER JOIN RETCSCH0  ON RETCTBL0.ETC_ID = RETCSCH0.ETC_SEARCH_ETC_ID
===

SELECT RETCTBL0.ETC_ID, RETCTBL0.ETC_NAME, RETCTBL0_1.ETC_ID, RETCTBL0_1.ETC_NAME, RETCMED0.MEDID, RMIID1.MED_MEDID_DESC
FROM (((RETCTBL0 INNER JOIN RETCSCH0 ON RETCTBL0.ETC_ID = RETCSCH0.ETC_SEARCH_ETC_ID)
INNER JOIN RETCMED0 ON RETCSCH0.ETC_PRODUCT_RELATED_ETC_ID = RETCMED0.ETC_ID) INNER JOIN
RMIID1 ON RETCMED0.MEDID = RMIID1.MEDID) INNER JOIN RETCTBL0 RETCTBL0_1 ON RETCMED0.ETC_ID = RETCTBL0_1.ETC_ID
WHERE (((RETCTBL0.ETC_ID)=78))
ORDER BY RETCTBL0.ETC_ID, RETCTBL0.ETC_NAME, RMIID1.MED_MEDID_DESC;

SELECT RETCTBL0.*
FROM (((RETCTBL0 INNER JOIN RETCSCH0 ON RETCTBL0.ETC_ID = RETCSCH0.ETC_SEARCH_ETC_ID)
INNER JOIN RETCMED0 ON RETCSCH0.ETC_PRODUCT_RELATED_ETC_ID = RETCMED0.ETC_ID) INNER JOIN
RMIID1 ON RETCMED0.MEDID = RMIID1.MEDID) INNER JOIN RETCTBL0 RETCTBL0_1 ON RETCMED0.ETC_ID = RETCTBL0_1.ETC_ID
WHERE (((RETCTBL0.ETC_ID)=77))
ORDER BY RETCTBL0.ETC_ID, RETCTBL0.ETC_NAME, RMIID1.MED_MEDID_DESC;
select * from rgcnseq4 where upper(str60) like upper('%aspirin%')
select count(*) from retcmed0 where ETC_ID in (79, 3626, 3627, 3628, 5701, 5704, 5705, 5706, 5949, 5950, 5951, 5954, 6221, 6222 )

select * from rmiid1 where medid = 554685
select * from rmiid1 where medid = 555347
select * from rmiid1 where upper(med_medid_desc) like upper('%dt%')
select * from rminmid1 where upper(med_name) like upper('%dtap%')
select * from gst

select x.ndc, m.medid, m.med_medid_desc from RMINDC1 x, Rmiid1 m where m.medid = x.medid and rownum < 100 and m.med_status_cd=0 and upper(m.med_medid_desc) like upper('%aspir%')
select count(*) from rmiid1
select * from rmiid1 where upper(med_medid_desc) like upper('%bayer%')
select * from Retctbl0 etc, retcsch0 sch where etc.etc_parent_etc_id = 77 and etc.etc_id = sch.etc_search_etc_id

No comments: