SQL Tips
  • RSS Feed

Last modified on 3/8/2019 9:19 AM by User.

SQL Tips

  • How to Join more than one table (3): https://www.youtube.com/watch?v=G1OLrfjHDyw

Example: SELECT...

FROM `220001`.`vhsmas_dat` v

LEFT JOIN `250001`.`oehtrx_dat` o
ON RIGHT(v.`vhs_ref_num`,6) = o.`oeh_ord_num`
RIGHT JOIN `220001`.`vhdmas_dat` d
ON v.`vhs_vch_num` = d.`vhd_vch_num`
RIGHT JOIN `230001`.`glamas_dat` g
ON d.`vhd_act_num` = g.`gla_act_num`

 

  • Field dictionary: r05669.pdf
  • How to run a report by either "X" or "Y"
Example: running a report by either customer number or report class
WHERE 
        CASE WHEN '?' = 'C' THEN 
            i.`IHS_CUS_NUM` = '?'
        ELSE 
            im.`INV_PRD_CLS` = '?'
        END