All community
This category
This board
Knowledge base
Users
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forÂ
ShowÂ
 onlyÂ
|
Search instead forÂ
Did you mean:Â
Exit
Global community
Language:
Deutsch
English
Español
Français
Português
日本語コミュニティ
Dedicated community for Japanese speakers
í•œêµ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Sign In
Home
ColdFusion
Discussions
For one column I need some logic, return null in s...
Home
ColdFusion
Discussions
For one column I need some logic, return null in s...
0
Upvote
For one column I need some logic, return null in select
nikos101
Enthusiast
,
/t5/coldfusion-discussions/for-one-column-i-need-some-logic-return-null-in-select/td-p/843136
Dec 05, 2008
Dec 05, 2008
Copy link to clipboard
Copied
I have a query where I want to select stuff but for one column I need some logic
select a,b,c, { if (a=b ) return null, else return a - c} as d
I don't know how to do this,
Any ideas?
TOPICS
Database access
Views
717
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
5 Replies
5
Jump to latest reply
Dan_Bracuk
LEGEND
,
/t5/coldfusion-discussions/for-one-column-i-need-some-logic-return-null-in-select/m-p/843137#M77814
Dec 05, 2008
Dec 05, 2008
Copy link to clipboard
Copied
select case
when a = b then null
else a-c
end as d
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
nikos101
AUTHOR
Enthusiast
,
/t5/coldfusion-discussions/for-one-column-i-need-some-logic-return-null-in-select/m-p/843138#M77815
Dec 05, 2008
Dec 05, 2008
Copy link to clipboard
Copied
Worked a treat thanks
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
nikos101
AUTHOR
Enthusiast
,
/t5/coldfusion-discussions/for-one-column-i-need-some-logic-return-null-in-select/m-p/843139#M77816
Dec 05, 2008
Dec 05, 2008
Copy link to clipboard
Copied
Oh btw I'm trying some complex stuff but getting errors,can anyone see what's wrong with this:
declare @amount float
set @amount = (
case when @b = 'B' then
(select SUM(a) from t ) else
(select SUM(c) from t)
)
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Dan_Bracuk
LEGEND
,
/t5/coldfusion-discussions/for-one-column-i-need-some-logic-return-null-in-select/m-p/843140#M77817
Dec 05, 2008
Dec 05, 2008
Copy link to clipboard
Copied
my suggestion is to get your sql working first, and then put it into your sp.
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
-__cfSearching__-
Valorous Hero
,
/t5/coldfusion-discussions/for-one-column-i-need-some-logic-return-null-in-select/m-p/843141#M77818
Dec 05, 2008
Dec 05, 2008
Copy link to clipboard
Copied
LATEST
> can anyone see what's wrong with this:
You are missing the case END
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Post Reply
Preview
Exit Preview
never-displayed
You must be signed in to add attachments
never-displayed
Â
Resources
Documentation
ColdFusion User Guide