动车技术方案

22 阅读1分钟

#动车技术方案#

表设计

============================================================================================

1.动车票库存表

假设有3张票总库存

id quancheng(全程) 库存

id quanzhou_jinjiang_xiamen 3

2.库存详情

=============================================================================================

泉州站 晋江站 厦门站

id quanzhou jinjiang xiamen sold

1 1 1 1 1

2 1 1 0 1

3 0 1 1 1

中文注释

id:

quanzhou:泉州站

jinjiang:晋江站

xiamen:厦门站

============================================================================================

查询全程

select count(*) where quanzhou=1 or jinjiang=1 or xiamen=1 >=3

查询半程泉州到晋江站的票 全程 半程

(select count(*) where quanzhou=1 and jinjiang=1 and xiamen=1)

and

(select count(*) where quanzhou=1 and jinjiang=1) >=3

============================================================================================ ————————————————

                        版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                    

原文链接:blog.csdn.net/qq_24700495…