I'm using Rhino Mocks to expect a call. There is a single parameter which is a string. But I'm not bothered about the case of the string. I want the test to pass even if the case is wrong. So I'm doing the following:
//expect log message to be called with a string parameter.
//We want to ignore case when verifiyig so we use a cons...
Strange problem.
My Query looks like
SELECT DISTINCT ID, `etcetc`, `if/elses over muliple joined tables` FROM
table1 AS `t1`
# some joins, eventually unrelated in that context
WHERE
# some standard where statements, they work/
CASE
WHEN `t1`.`field` = "foo" THEN (`t1`.`anOtherField` != 123 AND `t1`.`anOtherField` != 456 A...
Hello everyone,
Basically, we have an ASP website right now that I'm converting to PHP. We're still using the MSSQL server for the DB -- it's not moving.
In the ASP, now, there's an include file with a giant sql query that's being executed. This include sits on a lot of pages and this is a simple version of what happens. Pages A, B and...
I need to somehow use the CASE syntax (which is beyond me) to affect the database results based on criteria.
I have a bunch of royalties in 0.# form (royalty)
I have a title ID # (title_id) and I need to show the new increase in royalties so that I can use the data.
IF: they have a current royalty of 0.0 - 0.1 = 10% raise
IF: th...
I got a stored procedure that delivers a table of students, and it needs to order by surname, name etc... it also needs to sort ascending, descending, depending on the parameter @orderby...
code:
ORDER BY
CASE
WHEN @orderby = 'studentkey' THEN Studentkey END ASC,
CASE
WHEN @orderby = 'studentkey' and @desc = 1 THEN Studentkey END D...
Why doesn't the compiler automatically put break statements after each code block in the switch? Is it for historical reasons? When would you want multiple code blocks to execute?
...
I'm trying to join the NAME and PHOTO from USERS table to the TRANSACTIONS table based on who is the payer or payee. It keeps telling me can't find the table this -- What am I doing wrong?
SELECT `name`,`photo`,`amount`,`comment`,
(
CASE `payer_id`
WHEN 72823 THEN `payee_id`
ELSE `payer_id`
END
) AS `this`
FROM `transact...
Problem: Turn "my testtext TARGETSTRING my testtext" into "my testtext targetstring my testtext"
Perl supports the "\L"-operation which can be used in the replacement-string.
The Pattern-Class does not support this operation:
Perl constructs not supported by this class:
[...]
The preprocessing operations \l \u, \L, and \U.
...
Here is the query in Oracle I was trying to remove the redundant math operation from:
SELECT name,
CASE
when nvl(num1,0) + nvl(num2,0) - nvl(num3,0) > 0
THEN nvl(num1,0) + nvl(num2,0) - nvl(num3,0)
ELSE 0
END
as result,
.... from ....
How do I not repeat the summation above?
The 'result...
I'm fairly new to the C preprocessor. Is it possible to change the case of an argument provided to a function-like #define? For example, I want to write test(size) and then involve "Size" in the resulting replacement.
...
Generally which is better to use?:
case n
when 'foo'
result = 'bar'
when 'peanut butter'
result = 'jelly'
when 'stack'
result = 'overflow'
return result
or
map = {'foo' => 'bar', 'peanut butter' => 'jelly', 'stack' => 'overflow'}
return map[n]
More specifically, when should I use case-statements and when should I simply use a ha...
i wrote the following section below.
when debugging, i see that i enter the first Case okay.
my problem is with the second Case - it does not enter it and goes to the error messege.
what do i do wrong?
Select Case Data_Rate
Case "1", "2", "5.5", "11", "6", "9", "12", "18", "24", "36", "48", "54"
a = Data_Rate
Select Case Dat...
In Visual Foxpro 9 I am trying to write an sql with a product "subtotal" column and a report "total" column.
The sql code that works is as follows, but when I insert the commented out "Case" code I get errors that seem to increase as I correct the preceeding error.
Can any one tell me in which place I should insert the "case" and what is...
Hi
I need to check for
"Apple" = "Apple" TRUE
"Apple" = "APPLE" TRUE
"Apple" = "Apple1" FALSE
in ruby
I need a string comparison but for the check to not be case sensitive.
thks
...
I have an accounts table and a records table where accounts have multiple records. I would like to break down the account totals by "count of records" range. i.e. show the breakdown of
Count of Records | Count
0-25 | 100
25 - 50 | 122
50 - 100 | 300
etc.
I am using the following query, but I can't get it to group by "grp" which is ...
This is what I'm doing:
while (@counter < 3 and @newBalance >0)
begin
CASE
when @counter = 1 then ( @monFee1 = @monthlyFee, @newBalance = @newBalance-@fee)
when @counter = 2 then ( @monFee2 = @monthlyFee, @newBalance = @newBalance-@fee)
END
@counter = @counter +1
end
I get this error:
Incorrect syntax near the keyword 'CASE...
I'm trying to construct a T-SQL statement with a WHERE clause determined by an input parameter. Something like:
SELECT * FROM table
WHERE id IN
CASE WHEN @param THEN
(1,2,4,5,8)
ELSE
(9,7,3)
END
I've tried all combination of moving the IN, CASE etc around that I can think of. Is this (or something like it) possible?
...
Good Afternoon,
I am trying to assign some variables to a listing which has a main category and a subcategory. This works fine for most of the variables, however in each sub category there are some fields which are other.
ie
Main Category 1 has sub category database, development and other
Main Category 2 has sub category email, interne...
What is the most elegant (or least ugly) way of using typed constants in a case statement in Delphi?
That is, assume for this question that you need to declare a typed constant as in
const
MY_CONST: cardinal = $12345678;
...
Then the Delphi compiler will not accept
case MyExpression of
MY_CONST: { Do Something };
...
end;
...
In my VBA code, I query a SQL table. I want to add an if/then statement so if one radio button is selected it pulls a certain value, and if the other radio button is selected, it pulls a different value. My if is radiobutton1, and my else is radiobutton2, although the else can just be to take the other value.
Here's the specific part of...