查询多表集合(union)、查询时建临时字段、查询时给字段设置默认值
(select recharge_arrive_time as time,recharge_amount as amount,state,'充值' AS type from onlinerecharge where user_id=1)
UNION
(select confirm_time as time,withdraw_cash_amount as amount,state,'提现' AS type from withdrawcash where user_id=1)
UNION
(select i.create_time as time,i.investment_amount as amount,i.invest_state as state, b.bid_name as type from invest i
INNER JOIN bid b
on i.bid_id=b.bid_id
where i.user_id=1)
UNION
(select r.exact_repayment_time as time,r.should_repayment_amount as amount,r.state as state, b.bid_name as type from repayment r
INNER JOIN bid b
on r.bid_id=b.bid_id
where r.user_id=1)
UNION
(select created_date_long as time,reward_amount as amount,reward_source as state,reward_name AS type from investreward where user_id=1)
UNION
(select a.created_date_long as time,a.actual_amount as amount,ac.amount as state,'多利宝存入' as type from dollyadd a
INNER JOIN dollyflow f
on a.dolly_flow_id= f.dolly_flow_id
INNER JOIN dollyaccount ac
ON a.user_id = ac.user_id
where a.user_Id = 1)
UNION
(select r.redeeml_arrive_time as time,r.amount as amount,'' as state,'多利宝赎回' as type from dollyredeem r
INNER JOIN dollyflow f
ON r.dolly_flow_id=f.dolly_flow_id
where r.user_id=1)
UNION
(select u.hb_get_time as time,h.hongbao_amount as amount,h.hongbao_name as state,'红包奖励' as type from userhongbao u
INNER JOIN hongbao h
ON u.hongbao_id= h.hongbao_id
where user_id=1)
ORDER BY time DESC
查询多表集合(union)、查询时建临时字段、查询时给字段设置默认值的更多相关文章
- 《Entity Framework 6 Recipes》中文翻译系列 (14) -----第三章 查询之查询中设置默认值和存储过程返回多结果集
翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 3-6在查询中设置默认值 问题 你有这样一个用例,当查询返回null值时,给相应属性 ...
- 【杂记】mysql 左右连接查询中的NULL的数据筛选问题,查询NULL设置默认值,DATE_FORMAT函数
MySQL左右连接查询中的NULL的数据筛选问题 xpression 为 Null,则 IsNull 将返回 True:否则 IsNull 将返回 False. 如果 expression 由多个变量 ...
- ant-design-pro弹出框表单设置默认值
项目需求需要使用ant-design-pro的弹出框表单并在表单出现时设置默认值 然而按照官方的示例给 <Input> 标签设置 defaultValue 时发现并没有效果.如下所示: & ...
- java 反射: 当Timestamp类型的属性值为null时,设置默认值
import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Metho ...
- Vue 父组件传递给子组件,设置默认值为数组或者对象时
在vue 父子组件传参过程中,传递对象或者数组时,设置默认值为{}或者[] 错误写法: props: { pos: { type: [Object, Array], default: []//这是错误 ...
- sql 列设置默认值,语法查询知识点积累
一.修改字段默认值 alter table 表名 drop constraint 约束名字 ------说明:删除表的字段的原有约束 alter table 表名 add constraint 约 ...
- 【转载】mysql建表date类型不能设置默认值
如题,mysql建表date类型的不能设置一个默认值,比如我这样: CREATE TABLE `new_table` ( `biryhday` datetime NULL DEFAULT '1996- ...
- .NET DateTime类型变量作为参数时设置默认值
一个小的 Tips. .NET 中函数参数的默认值需要是编译时常量.如果参数是引用类型,可以设置Null,如果是值类型,可以设置相应的编译时常量,如整型可以用整数,但对于DateTime(结构体,值类 ...
- PHP 判断是表单否有这个参数,如果没有则设置默认值
<?php @$name = $_GET["name"]; if(isset($name)) { echo "name = " .$name; } els ...
随机推荐
- js常见报错解决方法
1.获得类名document.getElementsClassName(常出现一个问题): getClassName("gn","pt")[0].appendC ...
- java集合线程安全测试
package com.cxy; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import ...
- 断电后gitlab报500错误启动出错
异常断电后,gitlab报500错误,重启无效 通过sudo gitlab-ctl reconfigure启动时, 提示 [execute] pgsql:could not connect to se ...
- Ubuntu定时任务设置
设置很简单,但如果误入歧途,会耽误很多时间 步骤如下: 1. 以root执行:vi /etc/crontab 2. 在文件最后添加cron配置(每天凌晨四点执行,并将日志输出到/data/cron.l ...
- Storm个人学习总结
https://www.jianshu.com/p/c7fba7d6a24d https://www.cnblogs.com/peak-c/p/6297794.html https://blog.cs ...
- es第三篇:Search APIs
大多数search API都是可以操作多个索引的,除了explain API. 当执行一个search API时,可以指定routing参数,去搜索特定的主分片及其副本分片.routing参数值可以是 ...
- Robot Framework(AutoItLibrary库关键字介绍)
AutoItLibrary库关键字 AutoItLibrary 的对象操作大体上有几大主要部分,Window 操作.Control 操作.Mouse 操作.Process操作.Run 操作.Reg 操 ...
- LinuxShell脚本编程基础2-变量与数值运算、父shell和子shell
1.变量和数值运算 Shell脚本的变量不需要声明的 对变量赋值有两种方式, 直接用“=” 或者用键盘输入值 #!/bin/bash name1="Jack" echo $name ...
- 转 关于shell中if 语法结构的广泛误解
转自 ttp://blog.csdn.net/security134/article/details/6742156 最近学习SHELL编程 这篇文章很好很重要.有些东西不能想当然.同时不是表面看起来 ...
- dll和so文件区别与构成
http://www.cnblogs.com/likwo/archive/2012/05/09/2492225.html 动态链接,在可执行文件装载时或运行时,由操作系统的装载程序加载库.大多数操作系 ...