2016年7月31日 星期日

Oracle SQL 查詢 Left join 針對右表條件

Oracle 查詢時,常常會使用到JOIN 但是 針對右表 的過濾條件
放置where 條件 會因為右表 不存在而導致 查詢 失敗。




    select * from a  left join b 
    on a.id = b.id 
    where a.c1 = 2 
    and b.c1 = 3 
    --查詢會造成B表的欄位不存在時,查詢會造成0結果 需特別改成,因為where語法,是用於LEFT JOIN 的結果過濾
    
    --以下查詢會依照 a表為主表 b表的過濾條件當成 join 條件
    select * from a left join b
    on a.id =b.id and b.c1 =3 
    where a.c1=2;
    

2016年7月27日 星期三

關於PLSQL日期工具


myear number;
mmonth number; 

myear := extract(month from to_date(obj,'yyyyMM')) -- 取出年
mmonth := extract(year from to_date(obj,'yyyyMM')) -- 取出月

2016年7月25日 星期一

JQuery 選擇器

取得所有 checkbox 選擇的長度   並且全部打勾 
 





取得查詢畫面查詢內容 可利用 下列 function 觸發可由按鈕進行觸發
 //取得checkbox  
 var checklength =  $("input[name='checkbox']:checked").length;
                    //intput :輸入型別
                    //name :名稱
                    //checked:動作 
                    //length:長度

  $("input[name='checkbox']:checked").each(function(){
     $(this).attr("checked",true);
  });
 //取得所有 有 checked 的按鈕checkbox
 //each() --每個

Qrcode 建立




使用Google zxing.EncodeHintType
 下載的Jar檔理論上只要下載core(核心就好)

package com.joey.test;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Hashtable;

import javax.imageio.ImageIO;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.CharacterSetECI;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;

public class Test {
 public static void main(String[] args){
  BufferedImage buggimg = new BufferedImage(1200, 1200, BufferedImage.TYPE_INT_RGB);
  //指定寫出的資料夾  可由設定檔設定 位置
  File outFule = new File("D:/Qrcode.png");
  //建立QRCODE 相關設定。
  Hashtable hitmap = new Hashtable();
  QRCodeWriter qrwrite = new QRCodeWriter();
  hitmap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
  //建立圖片的繪版
  Graphics2D g2d = buggimg.createGraphics();
  
  g2d.setColor(Color.WHITE);
  g2d.fillRect(0,0,1200,1200);
  g2d.setColor(Color.black);
   try {
   //取得圖片的 點 的大小 圖片大小設定 1200 1200 px s 圖片
   BitMatrix x = qrwrite.encode("yourMassage", BarcodeFormat.QR_CODE, 1200, 1200,hitmap);
   for(int i =0;i<1200;i++){
    for(int j=0;j<1200;j++){
     if(x.get(i, j)){
      g2d.fillRect(i, j, 1, 1);
     }
    }
   }
   //寫出圖片..
   ImageIO.write(buggimg,"png", outFule);
  } catch (Exception e) {
   e.printStackTrace();
  }


2016年7月24日 星期日

jQuery使用Selecter移動Option 內容。

//取得某Select 畫面所有的Option
function optionMoveAdd(移動的Val[]){
$('select[name="selectName"]').find('option').each(function(){
  ///簡易的畫面將所有的OPTION的內容一放到另一個 select  
   for(var i =0;i<obj.length;i++){
     if(obj[i]==$(this).val()){
       $('select[name="sourceSelect"]').append($(this));
      }
   }
 }

 }); }
function optionMovedlect(移動的Val[]){
$('select[name="selectName"]').find('option').each(function(){
  ///簡易的畫面將所有的OPTION的內容一放到另一個 select   
   for(var i =0;i<obj.length;i++){
     if(obj[i]==$(this).val()){
       $('select[name="sourceSelect"]').append($(this));
      }
   }
 }

 });
select 需要增加屬性  multiple="multiple"是可多選的意思  
size = 顯示 ---比數 
    
    
     //或許可加上增加或是刪除扭