in Education by
I have not used access before but I have to convert an access query into SQL so I can write a report in crystal. The query currently uses the IFF function in its select statement which appears to determine what value will be returned depending on the table's value for a particular column. So for instance if the value is "CR" it should be returned as "credit" and if it's "NCR" it should be returned as "non-credit" Can I do something like this in SQL? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Use the CASE expression. Head over to this video to learn CASE expression in detail: CASE WHEN Some_Column = 'CR' THEN 'credit' WHEN Some_Column = 'NCR' THEN 'non-credit' END Refer to this video to understand how IFF function works: Let’s understand how IFF function works: We can consider IFF function as a combination of IF-ELSE and CASE statements. IFF function accepts 3 arguments which are as follows: Boolean expression is the first argument. This returns either true or false. If the result of the first expression holds ‘true’ then the 2nd argument will result as output otherwise 3rd argument. Syntax: IIF (Boolean_Expression, True_Value, Flase_Value) Example: SQL IFF query to compare two integers: SELECT IIF(15 > 10, 'TRUE', 'FALSE') AS Result; In the above example, you can observe that Condition inside IIF function (i.e., 15>10) is TRUE. So, the second argument is returned as output, which is TRUE

Related questions

0 votes
    I have not used access before but I have to convert an access query into SQL so I can write a report in crystal ... like this in SQL? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am trying to make a a query against a table and am kind of stuck in constructing the WHERE ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I'm working with secure application roles to grant access to users. In its dumbest form, it looks like ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I am using oracle 10g. I have a database user TDM_DD which executes a procedure in which it creates ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 3, 2022 in Education by JackTerrance
0 votes
    I'm using the Microsoft Access to do the SQL and is there any way for me to set the criteria for ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 3, 2022 in Education by JackTerrance
0 votes
    I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of ... WHERE ... Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of ... WHERE ... Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I want to import an oracle dump into a different tablespace. I have a tablespace A used by User A ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 30, 2022 in Education by JackTerrance
0 votes
    I want to import an oracle dump into a different tablespace. I have a tablespace A used by User A ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    I have to insert data in a table. It has a colum whose values should negative numbers like -1,-2 ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    Slightly unimportant but it's piqued my curiousity. I've just logged into an Oracle 10g database for the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Slightly unimportant but it's piqued my curiousity. I've just logged into an Oracle 10g database for the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Slightly unimportant but it's piqued my curiousity. I've just logged into an Oracle 10g database for the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    I would like to ask for performance of SQL. This is my query: Select A.code ,A.name ,(Select B. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I've been following this video( to install bWAPP on Parrot ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
...