Jump to content

INSERT IF EXISTS


Lijoyx

Recommended Posts

hai friends,

 

here is my question

 

1.

INSERT INTO category_master (Category_Id, Category_Name) VALUES (1,'Business to Business') WHERE NOT EXISTS(SELECT * FROM category_master WHERE Category_Name = 'Business to Business')

 

2.

 

IF NOT EXISTS(SELECT * FROM category_master WHERE Category_Name = 'Business to Business') INSERT INTO category_master (Category_Id, Category_Name) VALUES (1,'Business to Business')

 

i am getting an error while executing these queries.

whats wrong with it.

 

appreciate each help.

Link to comment
https://forums.phpfreaks.com/topic/116388-insert-if-exists/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.