I
I
Igor Bezlepkin2017-01-13 10:42:47
PHP
Igor Bezlepkin, 2017-01-13 10:42:47

How to insert a value into a table in a varchchar field, depending on whether it exists in another table?

Hey! I enter into the user base. There is a roles table. When entering, I want mysql to check if there is such a role in the table with roles, if there is, INSERT occurs. Such a certain range.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2017-01-13
@d-stream

in the framework of tsql, this is usually implemented either by logic:
if exists (....) begin
insert
end
or insert from select, where the presence check appears in the select selection condition in one form or another

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question