(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)、查询时建临时字段、查询时给字段设置默认值的更多相关文章

  1. 《Entity Framework 6 Recipes》中文翻译系列 (14) -----第三章 查询之查询中设置默认值和存储过程返回多结果集

    翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 3-6在查询中设置默认值 问题 你有这样一个用例,当查询返回null值时,给相应属性 ...

  2. 【杂记】mysql 左右连接查询中的NULL的数据筛选问题,查询NULL设置默认值,DATE_FORMAT函数

    MySQL左右连接查询中的NULL的数据筛选问题 xpression 为 Null,则 IsNull 将返回 True:否则 IsNull 将返回 False. 如果 expression 由多个变量 ...

  3. ant-design-pro弹出框表单设置默认值

    项目需求需要使用ant-design-pro的弹出框表单并在表单出现时设置默认值 然而按照官方的示例给 <Input> 标签设置 defaultValue 时发现并没有效果.如下所示: & ...

  4. java 反射: 当Timestamp类型的属性值为null时,设置默认值

    import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Metho ...

  5. Vue 父组件传递给子组件,设置默认值为数组或者对象时

    在vue 父子组件传参过程中,传递对象或者数组时,设置默认值为{}或者[] 错误写法: props: { pos: { type: [Object, Array], default: []//这是错误 ...

  6. sql 列设置默认值,语法查询知识点积累

    一.修改字段默认值 alter table 表名 drop constraint 约束名字   ------说明:删除表的字段的原有约束 alter table 表名 add constraint 约 ...

  7. 【转载】mysql建表date类型不能设置默认值

    如题,mysql建表date类型的不能设置一个默认值,比如我这样: CREATE TABLE `new_table` ( `biryhday` datetime NULL DEFAULT '1996- ...

  8. .NET DateTime类型变量作为参数时设置默认值

    一个小的 Tips. .NET 中函数参数的默认值需要是编译时常量.如果参数是引用类型,可以设置Null,如果是值类型,可以设置相应的编译时常量,如整型可以用整数,但对于DateTime(结构体,值类 ...

  9. PHP 判断是表单否有这个参数,如果没有则设置默认值

    <?php @$name = $_GET["name"]; if(isset($name)) { echo "name = " .$name; } els ...

随机推荐

  1. threejs的学习笔记

    很多时候,我们在开发3d效果的时候,容易搞不清楚x,y,z坐标分别指示哪个方向 在开发threejs的时候可以先把坐标系添加到场景中,起到一个启示作用. js // show axes in the ...

  2. Ubuntu如何配置网桥 Ubuntu系统配置网桥详细教程

    注意:如果是在ubuntu桌面版本上使用,图形化控制与ifupdown配置不兼容.如果使用ifupdown来配置,需要禁止使用图形化控制. 本文经过本人结合网络内容亲身实践,配置通了ifupdown ...

  3. PHP将多维数组变成一维数组

    function reduceArray($array) { $return = []; array_walk_recursive($array, function ($x) use (&$r ...

  4. FPGA基础学习(7) -- 内部结构之CLB

    目录 1. 总览 2. 可配置逻辑单元 2.1 6输入查找表(LUT6) 2.2 选择器(MUX) 2.3 进位链(Carry Chain) 2.4 触发器(Flip-Flop) 参考文献: 一直以来 ...

  5. javascript 将 table 导出 Excel ,可跨行跨列

    <script language="JavaScript" type="text/javascript"> //jQuery HTML导出Excel ...

  6. git常用安装包,指令

    babel-polufill  -es6  API转义 npm install --save @babel/polyfill babel-runtime -es语法转义 npm install --s ...

  7. java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.String

    在重构项目的时候,遇到了mybatis的一个异常: java.lang.IllegalArgumentException: invalid comparison: java.util.Date and ...

  8. Golang框架beego和bee的开发使用

    Golang语言简洁.明细,语法级支持协程.通道.err,非常诱惑人.平时也看了看Golang的语法,正苦于没有需求,我想把beego的源码搬过来看看. 首先,第一步:beego环境的搭建 在我之前看 ...

  9. 再探display:table-cell &&左边固定、右边自适应

    display:table-cell;这个属性用的不多,它和td差不多,但是如果可以用好还是能收益不少的,下面举例说明. 1. 父元素display:table-cell,并设置verticle-al ...

  10. MySQL约束和修改数据表知识集结

    一.约束 划分标准:功能.数据列的数目 功能: (1)NOT NULL(非空约束) (2)PRIMARY KEY(主键约束) (3)UNIQUE(唯一约束) (4)DEFAULT(默认约束) (5)F ...