查询多表集合(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 ...
随机推荐
- ubuntu安装gnome桌面
1. apt install gnome-shell 2. apt install ubuntu-gnome-desktop 3. apt install unity-tweak-tool 4. ap ...
- iOS 轻松使用 App 数据统计
想获取用户各项行为数据吗? 想轻松查看用户行为图表吗? 想高效进行 App 运营管理吗? 想,来我带你玩转 App 数据统计.这里我使用专业.轻便的 JAnalytics. 本文内容分为两部分:代码示 ...
- Run Faster-JAVA
又好久没有写点啥了,平时都忙于工作,忙于应付工作中的问题,各种吸收却并没有好好的消化,该是"反刍"一下的时候了. 本篇名叫"Run Faster,JAVA",其 ...
- spring ThreadPoolTaskExecutor使用总结
ThreadPoolTaskExecutor提供TaskDecorator可以实现类似ThreadPoolExecutor.afterExecute()类似功能 taskDecorator主要是对Ru ...
- 使用范围for语句处理多维数组
在C++11新标准中新增了范围for语句,所以遍历多维数组可以用如下形式: int num[rowCnt][colCnt]; for(auto &row : num){ for(auto &a ...
- AS添加依赖库提示Manifest merger failed解决办法
今天在学习<Android权威编程指南>时 在project structure中添加recyclerview时提示错误 按照提示添加tools:replace标签还是报错 然后切换至bu ...
- A: Absolutely Simple---巴什博弈
A: Absolutely Simple 时间限制: 1 s 内存限制: 128 MB 题目描述 Ocean暑假去海边玩,海边有许多好看的贝壳.并且Ocean捡了好多回来. 回 ...
- kafka的安装及基本使用
1.安装zookeeper # 解压缩 [root@localhost zookeeper]# .tar.gz [root@localhost zookeeper]# zk_simple # 复制zo ...
- WCF系列教程之初识WCF
本随笔参考自WCF编程系列(一)初识WCF,纯属读书笔记,加深记忆. 1.简介:Windows Communication Foundation(WCF)是微软为构建面向服务的应用程序所提供的统一编程 ...
- 怎么高效查找和正确改变谷歌浏览器编码格式(新版和旧版Google Chrome)(图文详解)
前言 今天,无意中在解决一个乱码问题,后台是有过判断解决兼容性问题,但是有个别电脑还是有乱码问题,就去想改变下前台的编码格式,突然发现一向好用的谷歌,居然找不到编码格式了! 上网百度了半天,查阅各种网 ...