I have created a very long code on my app for checking if a record exist then insert.

Is it possible for a single SQLString to check if records exist then update or insert?

Sorta like

IF NOT EXISTS (SELECT column1 FROM table WHERE column1 = 'sample1')
THEN
(INSERT INTO table(column1,column1,column1) VALUES('sample','sample','sample'))
END IF

@yorro : Is it possible for a single SQLString to check if records exist then update or insert?

Use Stored-Procedure.

Note that my mySQL does not work, does anyone have a sample code for a mySQL with a condition of IF EXIST before inserting?

commented: Read sticky thread - Homework policy. -4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.