我们经常会遇到需要将一个表中某些字段的值批量更新到另一个表的对应记录下的对应字段中去的情况。
MS SQL Server的语法:
update t1 set t1.tValue = t2.tValue
from t1
inner join t2 on t1.id = t2.id
例子:
update area
set area_phone_code = z.code
from area
inner join test.zipcode z
on z.areaid = a.area_code
MySQL的语法:
update table1 t1 ,table2 t2 set t1.tValue =t2.tValue where
t1.id=t2.id
例子:
update area a, test.zipcode z
set a.area_phone_code = z.code
where z.areaid = a.area_code
两种数据库在这个语法上面差异还是很大的。
钱数转中文汉字(转)(2009-07-10 11:16)
public class MoneyTest {
private static final String[] NUMBERS = { '零',
'壹', '贰', '叁', '肆', '伍',
'陆', '柒', '捌', '玖' };
private static final String[] IUNIT = { '元',
'拾', '佰', '仟', '万', '拾', '佰',
'仟', '亿', '拾', '佰', '仟', '万', '拾', '佰', '仟' };
private static final String[] DUNIT = { '角',
'分', '厘' };
public static synchronized String
toChinese(String str) {
str =
str.replaceAll(',', '');// 去掉','
String integerStr;//
整数部分数字
String decimalStr;// 小数
JAVA日期转中文汉字(转)(2009-07-10 11:13)
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DateToUpperChinese {
private static final String[] NUMBERS = { '零',
'壹', '贰', '叁', '肆', '伍',
'陆', '柒', '捌', '玖' };
public static synchronized String
toChinese(String str) {
StringBuffer sb = new
StringBuffer();
sb.append(getSplitDateStr(str, 0)).append(' ').append(
getSplitDateStr(str, 1)).append(' ').append(
getSplitDateStr(str, 2));
return
sb.toString();
}