Ask a Question related to Coldfusion Database Access, Design and Development.
-
Fordian-Slip #1
Comparing 2 values in a SQL Select
Hi Folks -
I was wondering if anybody knows how to get a single value result from 2
previous calculated results...
Here's my query...
__________________________________________________ ______________________
Select Year(dateeffective) as year1,Month(dateeffective) as
month1,count(uwaction) as total1,
Sum(bound_premium) as Bound1,Sum(quoted_premium) as Quoted1,
IIF(Bound1>=Bound1,bound1,quoted1) as new_output
From q_quotes_tbl
Where dateeffective >= '01/01/05' and dateeffective <= '09/20/05' and lob_id=3
and quotetype='new' and
((Cast(bound_premium as numeric) is not null and Cast(bound_premium as
numeric) > 0) or
(Cast(quoted_premium as numeric) is not null and Cast(quoted_premium as
numeric) > 0))
group by year(dateeffective),Month(dateeffective)
order by year(dateeffective),Month(dateeffective)
__________________________________________________ ______________________
I am having a problem with this line:
IIF(Bound1>=Quoted1,bound1,quoted1) as new_output
What I want to do is to Sum two different fields, and then show me only the
greater of the two fields totals.
Any and all help is appreciated.
Thanks,
Doug
Fordian-Slip Guest
-
#39579 [NEW]: Comparing zero & string values in boolean comparison has unexpected behaviour
From: iain at workingsoftware dot com dot au Operating system: FreeBSD 6.1 PHP version: 5.2.0 PHP Bug Type: Class/Object... -
Comparing 2 columns in my select
I have 3 columns, name - price1 - price2 I want to compare price1 against price2 during my select and only return the greatest value to my... -
Difficulty with SELECT statement using TWO values
hello, I am having difficulty getting select statement to work. i need to SELECT value1, value2, value3, FROM table WHERE garage = requestform... -
Comparing values
i have created three fields named (username, surname & pin) and when the user enters in the information, i want it to compare the values from three... -
comparing field values
Hi I have a problem...I need to be able to compare the values entered in a series of fields against a set of rules. For example, lets say I have... -
Dan Bracuk #2
Re: Comparing 2 values in a SQL Select
how about
Select Year(dateeffective) as year1,Month(dateeffective) as
month1,count(uwaction) as total1,
Sum(bound_premium) as Bound1,Sum(quoted_premium) as Quoted1,
case when bound1 >= quoted1 then bound1 else quoted1 end as new_output
etc
Dan Bracuk Guest



Reply With Quote

