You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-10-31 18:30:33 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			92 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			92 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # -------------------------------------------------------------- #
 | |
| # Test case migrated from regression test suite: bug3295.sql
 | |
| #
 | |
| # Author: Daniel Lee, daniel.lee@mariadb.com
 | |
| # -------------------------------------------------------------- #
 | |
| #
 | |
| --source ../include/have_columnstore.inc
 | |
| #
 | |
| USE tpch1;
 | |
| #
 | |
| --disable_warnings
 | |
| drop table if exists visit;
 | |
| drop table if exists client;
 | |
| --enable_warnings
 | |
| 
 | |
| create table visit (id_client integer,nb_event integer,update_date datetime, visit_date datetime) engine=columnstore;
 | |
| create table client (id_client integer,id_event integer,event_date datetime) engine=columnstore;
 | |
| 
 | |
| insert into visit values (1,0,NULL,"2010-09-08"); 
 | |
| insert into visit values (2,0,NULL,"2010-09-08"); 
 | |
| insert into visit values (2,0,NULL,"2010-09-10"); 
 | |
| insert into visit values (3,0,NULL,"2010-09-08"); 
 | |
| insert into visit values (3,0,NULL,"2010-09-10"); 
 | |
| insert into client values (1,20,"2010-09-07");
 | |
| insert into client values (1,21,"2010-09-07");
 | |
| insert into client values (1,22,"2010-09-07");
 | |
| insert into client values (2,23,"2010-09-07");
 | |
| insert into client values (2,24,"2010-09-07");
 | |
| insert into client values (2,25,"2010-09-10");
 | |
| insert into client values (3,29,"2010-09-10");
 | |
| 
 | |
| select * from
 | |
| visit V,
 | |
| (
 | |
| SELECT
 | |
| CL.id_client,
 | |
| COUNT(CL.id_event) as nb_event
 | |
| FROM
 | |
| client CL
 | |
| WHERE
 | |
| CL.event_date < "2010-09-10"
 | |
| GROUP BY
 | |
| CL.id_client
 | |
| ) Res
 | |
| WHERE
 | |
| V.visit_date ="2010-09-08"
 | |
| AND V.id_client = Res.id_client order by 1, 2, 3;
 | |
| 
 | |
| UPDATE
 | |
| visit V,
 | |
| (
 | |
| SELECT
 | |
| CL.id_client,
 | |
| COUNT(CL.id_event) as nb_event
 | |
| FROM
 | |
| client CL
 | |
| WHERE
 | |
| CL.event_date < "2010-09-10"
 | |
| GROUP BY
 | |
| CL.id_client
 | |
| ) Res
 | |
| SET 
 | |
| V.nb_event = Res.nb_event,
 | |
| V.update_date = '2010-12-11'
 | |
| WHERE
 | |
| V.visit_date ="2010-09-08"
 | |
| AND V.id_client = Res.id_client;
 | |
| 
 | |
| select * from
 | |
| visit V,
 | |
| (
 | |
| SELECT
 | |
| CL.id_client,
 | |
| COUNT(CL.id_event) as nb_event
 | |
| FROM
 | |
| client CL
 | |
| WHERE
 | |
| CL.event_date < "2010-09-10"
 | |
| GROUP BY
 | |
| CL.id_client
 | |
| ) Res
 | |
| WHERE
 | |
| V.visit_date ="2010-09-08"
 | |
| AND V.id_client = Res.id_client order by 1, 2, 3;
 | |
| 
 | |
| --disable_warnings
 | |
| drop table if exists visit;
 | |
| drop table if exists client;
 | |
| --enable_warnings
 | |
| #
 | |
| 
 |