Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 30 paź 2009 · I'm using MySQL, and I want to do a sort of ternary statement in my SQL like: SELECT USER_ID, ((USER_ID = 1) ? 1 : 0) AS FIRST_USER FROM USER The results would be similar to: USER_ID | FIRST_USER 1 | 1 2 | 0 3 | 0 etc. How does one accomplish this?

  2. See https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html. Additionally, you could handle when the condition is null. In the case of a null amount: SELECT id, IF (type = 'P', IFNULL (amount,0), IFNULL (amount,0) * -1) as amount FROM report.

  3. Definition and Usage. The IF () function returns a value if a condition is TRUE, or another value if a condition is FALSE. Syntax. IF (condition, value_if_true, value_if_false) Parameter Values. Technical Details. Works in: From MySQL 4.0. More Examples. Example. Return 5 if the condition is TRUE, or 10 if the condition is FALSE:

  4. 28 maj 2024 · We can use it to perform conditional branching within the SELECT statement across various SQL databases, including SQL Server, MySQL, and PostgreSQL. Within SQL SELECT, we can use the WHEN-ELSE statement instead of the traditional IF-ELSE. It evaluates a condition and returns a specific value depending on the outcome.

  5. www.mysqltutor.com › mysql-if-functionMySQL IF function

    The MySQL IF function is a control flow function that allows you to perform conditional logic within a query. It is commonly used in SELECT statements to return different values based on a specified condition.

  6. www.mysqltutorial.org › mysql-stored-procedure › mysql-if-statementMySQL IF Statement - MySQL Tutorial

    Summary. Use IF...THEN statement to conditionally execute a block of statements based on the evaluation of a specified condition. Use IF...THEN...ELSE statement to execute a block of statements if a specified condition is true and an alternative block of statements if the condition is false.

  7. The IF statement for stored programs implements a basic conditional construct. There is also an IF ()function, which differs from the IFstatement described here. See Section 14.5, “Flow Control Functions”. The IF statement can have THEN, ELSE, and ELSEIF clauses, and it is terminated with END IF. If a given search_condition evaluates to ...

  1. Ludzie szukają również