Reputation: 1
create table:-
CREATE TABLE default.bankIfsc (
`event_date` Date DEFAULT toDate(now()),
`id` Int32,
`uid` Int32,
`nid` Int32,
`bank` String,
`ifsc_code` String,
`micr_code` String,
`branch` String,
`address` String,
`contact` String,
`city` String,
`district` String,
`state` String,
`content` String,
`feature_image` String,
`var1` String,
`var2` String,
`var3` String,
`var4` String,
`var5` String,
`createdtime` Int32,
`createdtimestr` DateTime DEFAULT toDateTime(createdtime),
`updatedtime` Int32,
`updatedtimestr` DateTime DEFAULT toDateTime(updatedtime),
`status` Int32) ENGINE = ReplacingMergeTree(event_date, id, 8192)
datastore in this table and table view:-
CREATE TABLE default.bankIfsc_bck (
`id` Int32,
`uid` Int32,
`nid` Int32,
`bank` String,
`ifsc_code` String,
`micr_code` String,
`branch` String,
`address` String,
`contact` String,
`city` String,
`district` String,
`state` String,
`content` String,
`feature_image` String,
`var1` String,
`var2` String,
`var3` String,
`var4` String,
`var5` String,
`createdtime` Int32,
`createdtimestr` DateTime,
`updatedtime` Int32,
`updatedtimestr` DateTime,
`status` Int32) ENGINE = Log
insert data:-
INSERT INTO bankIfsc ( id, uid, nid, bank, ifsc_code, micr_code, branch,
address, contact, city, district, state, content, feature_image, var1,
var2, var3, var4, var5, createdtime, createdtimestr, updatedtime,
updatedtimestr, status )
SELECT (id, uid, nid, bank, ifsc_code, micr_code, branch, address,
contact, city, district, state, content, feature_image, var1, var2, var3,
var4, var5, createdtime, createdtimestr, updatedtime, updatedtimestr,
status)
FROM bankIfsc_bck;
The number of columns doesn't match. I got this error anyone help, please
Upvotes: 0
Views: 2188
Reputation: 13310
( ) -- makes tuple datatype.
2 columns -- select 1,2
desc (select 1,2)
┌─name─┬─type──┬
│ 1 │ UInt8 │
│ 2 │ UInt8 │
└──────┴───────┴
1 column -- select (1,2)
desc (select (1,2))
─name────────┬─type────────────────┬
tuple(1, 2) │ Tuple(UInt8, UInt8) │
─────────────┴─────────────────────┴
remove ( ) from your select
SELECT id, uid, nid, bank, ifsc_code, micr_code, branch, address,
contact, city, district, state, content, feature_image, var1, var2, var3,
var4, var5, createdtime, createdtimestr, updatedtime, updatedtimestr,
status
FROM bankIfsc_bck;
Upvotes: 1