I'd like to be able to force the
PACKAGE->add_columns() to not lc everything. I know there's a preserve_case option, but I can't figure out where to put it though. is there a 'myproj_schema.pl' file I can create in /conf ?
-Joe
...
Hi,
I have a SQL Select statement where I need to return certain values depending on a condition. I need to return multiple values each time, but my understanding of the Case statement is that you can only return a single value for each case.
I'm getting around this by using UNION statements at the moment, but it all looks a bit cum...
I would love to have a t-sql statement like the following...
SELECT [field]
FROM [table]
WHERE CASE @flag
WHEN 1 THEN col1 = @value
ELSE col2 = @different_value
END
The point being I want to put a flag in my function to use different where clauses in the same query. I just can't get it to work. Is this possible?
...
I have a (rather complicated) SQL statement where I select data from lots of different tables, and to cope with a bad legacy data structure, I have a couple of custom columns that get their values based on values from other columns. I have currently solved this with CASE statements:
SELECT
...,
CASE channel
WHEN 1 T...
Apparently NUMBER + NULL returns NULL in SQL. So I need it to add 0 instead of NULL but this isn't working, I'm getting a syntax error. I'm looking at the docs and this is what it says to do so I'm not sure...
SELECT sku, (qty + (SELECT
(CASE qty WHEN IS NULL THEN 0 ELSE qty END)
FROM other WHERE sku = Sheet1.sku LIMIT 1)) as qty
FROM...
I have an SQLite database with student names. Each student has different classes. I have a table with student grades and classes and another table that defines class by type. I'd like to run a query (that I'll be saving as a CSV to use in OpenOffice as an Excel document for a mail merge). I need to list the student's Math grade, History ...
Hi,
Can anyone help me explain why the changed line below returns a 0 instead of the requested 11 or 12?
I'm using MySQL, and this query otherwise runs, correctly... I'm attempting to catch the difference between a 0 and a null in the said field.
SELECT SUM(CASE WHEN pr.heatEventID=1 THEN pr.points+1 ELSE '-' END) AS `100m`
, SUM(...
I have a statement which is complicated like this:
select x.ColA as ColA
, case when x.optA = 'AB' or x.optA = 'FG' or x.optA = 'LM' or x.optA = 'QR' then X.ColB / 100 else X.ColB / 900 End as ColB
, case when x.optA = 'AB' or x.optA = 'FG' or x.optA = 'LM' or x.optA = 'QR' then X.ColC / 100 else X.ColC / 900 End as ColC
,...
I know it suppose to be like:
CASE
WHEN search_condition THEN statement_list
[WHEN search_condition THEN statement_list] ...
[ELSE statement_list]
END CASE
But I do not understand this, (maybe because I keep trying to think of it like an if statement?)
But for example if I have a field on a table called user_role, which a...
SQL Syntax is still something I am learning. I am getting the error noted below the this snippet of code.
SELECT
CASE WHEN LTRIM(RTRIM(cLehmanNo)) =' ' THEN NULL
WHEN cLehmanNo IS NOT NULL THEN REPLACE ( cLehmanNo,SUBSTRING (cLehmanNo,PATINDEX( '%[^a-zA-Z0-9 '''''']%',cLehmanNo),1), ' ' )
END asLOAN_NUMBER
,CASE WHEN ...
I need to return one of 2 values for certain conditions:
My different cases are:
when one column has 'substring' on the right end, return that column. (i.e. LIKE '%substring')
Else return other column (from other table)
This works:
SELECT * From Table1 where col1 is not null and col1 like '%substring'
However, this doesn't work:
...
I have a lot of code of the style:
do
x <- getSomething
case x of
this -> ...
that -> ...
other -> ...
Any way of me combining the "x <- ..." and "case x of" lines to eliminate the need for a variable?
...
Hello friends,
I am working with Delphi. I want to track on which key is pressed. I am using KeyDown event of TForm. It is working fine but the problem is that, if I press and lower case letter, though it gives me upper case of that letter. How can I recognize the key pressed is lower case or upper case?
...
Using a case construct for type-safe casting is easily done in scala. The following code ensures that square gets only called on objects which have an according type.
class O
class A extends O {
def square(i: Int):Int = { i*i }
}
class B extends O {
def square(d: Double):Double = { d*d }
}
class C extends O {}
def square(o: O) ...
Hi,
I need to code up a query for something like this:
Select [something]
Where
condition in
case
when (if another_condition = A and 3rd Condition = B) then (C,D)
when (if another_condition = N and 3rd Condition = E) then (F,G)
else (J,K)
end
essentially, what I want is if A and B are met, condition could be set to either C or D, if N...
Hi everyone,
I'm trying to create a switch statement but I can't seem to be able to use an expression that gets evaluated (rather than a set string/integer). I can easily do this with if statements but case should hopefully be faster.
I'm trying the following
function reward(amount) {
var $reward = $("#reward");
switch (amount...
Need help understanding what I am doing with the syntax here, please help! I not only need to convert from float to decimal but I also need to override the original data being migrated to the same format and data (in this case) where necessary to match the newer data.
,CASE
WHEN fInvReqMargin IS NOT NULL THEN
(CONVERT(DECIM...
The following query gives the error "#1241 - Operand should contain 1 column(s)" because of the (Department_Code, Course_Code) line. When I replace that with just (Course_Code) it works. However, that's not what I want
SELECT * FROM Classes
GROUP BY CASE
WHEN (1) THEN
Department_Code
ELSE CASE WHEN (2) THEN
(Department_Code, Cou...
I've got results being returned to a Google Mapping application in the div sidebar. The results are names of businesses that belong to categories that the client wants returned in a certain order. And unfortunately it's not a straight alpha sort. So one category begins with F and the second one with a C and the last three are A's, for...
I'm trying to make a proxy object that transfers almost all method calls to a child object, essentially the delegator pattern. For the most part, I'm just using a BasicObject and passing every call with method_missing to the child object. So far, so good.
The trick is that try as I might, I can't fool Ruby's case operator, so I can't ...