Как Вы пишете условное выражение в операторе выбора MySQL?

#include <iostream>

int main(int argc, char *argv[])
{
    char **strings = new char *[2]; // create an array of two character pointers
    strings[0] = "hello"; // set the first pointer in the array to "hello"
    strings[1] = "world"; // set the second pointer in the array to "world"

    // loop through the array and print whatever it points to out with a space
    // after it
    for (int i = 0; i < 2; ++i) {
        std::cout << strings[i] << " ";
    }

    std::cout << std::endl;

    return 0;
}
63
задан OMG Ponies 30 October 2009 в 04:19
поделиться

2 ответа

SELECT USER_ID, (CASE USER_ID WHEN 1 THEN 1 ELSE 0 END) as FIRST_USER FROM USER
84
ответ дан 24 November 2019 в 16:14
поделиться
SELECT USER_ID, IF(USER_ID = 1, 1, 0) AS FIRST_USER FROM USER

Оператор IF () работает аналогично тройному? : оператор.

57
ответ дан 24 November 2019 в 16:14
поделиться
Другие вопросы по тегам:

Похожие вопросы: