I would like to know if anyone has any idea on how to achieve the following:
Say i do the following:
SELECT User.Name, User.Surname, User.phone FROM User WHERE User.ID = 1
Now say i want to store the fields returned above to user defined variables.
SET @Name := User.Name
SET @Phone := User.Phone
How do i do this??
And how to i do an if statement in mysql.
If @Name = John THEN INSERT INTO ADMINTABLE() VALUES()
ELSE IF @Name = Paul THEN INSERT INTO SUPERISOR() VALUES()
How do i achieve the above?
And is there a way to iterate thru each row returned and the run functions against results?
Please someone help with any of the above
Thanks in advance