Sarjit Delivala
Sarjit Delivala

Reputation: 567

Column count doesn't match value count at row error in correct syntax

I have written an insert query but it throws an error #1136. I checked for comma and other syntax and field with NULL values are Null allowed is also checked. Its not working. I searched for similar questions but didn't help. I have tried it both the way.

1st way:

INSERT INTO postdetails SET
PostId = NULL,
EventId = 1, 
FacultyId = 'hemal.desai',
InstituteId = 1,
PostTitle = 'title',
PostMsg = 'msg',
PostDate = '2014-04-22',
EventDate = '2014-04-30',
PostTime = CURRENT_TIME(),
DeleteDate = '2014-04-30',
Edited = 'No',
FileURL = 'Null',
status = 'upcoming',
reason =NULL,
oldeventdate = NULL;

and the 2nd way:

INSERT INTO postdetails (PostId, EventId, FacultyId, InstituteId, PostTitle, PostMsg, PostDate, EventDate, PostTime, DeleteDate, Edited, FileURL, status, reason, oldeventdate) VALUES (NULL, '1', '[email protected]', '1', 'Sidddhi Mam', 'Message', '2014-04-22', '2014-04-29', CURRENT_TIME(), '2014-05-03', 'No', 'Null', 'upcoming', NULL, NULL);

My table structure is like this:

enter image description here

Please help me.

Upvotes: 0

Views: 500

Answers (1)

Ashish Jivani
Ashish Jivani

Reputation: 96

I have replicate the same structure to verify for issue and it working for me with provided insert query without changing anything.

So as SarjitDelivala suggested, please check for trigger or else provide complete error with table engine detail.

Upvotes: 1

Related Questions