• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

where clause

Guest
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Hi i have this where clause

WHERE
Season = <CFIF isdefined ("FORM.Years")>'#FORM.Years#'<CFELSE>2</CFIF>

this works but what i need to do is if the form is not defined then = the maximum of the column

eg if in the column was 1,1,2,2,3,3
then = 3

can this be done?
TOPICS
Advanced techniques

Views

219

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Select *
From myTable
Where Season =
<CFIF isdefined ("FORM.Years")>'#FORM.Years#'
<CFELSE>
(Select Max(myColumn) From myTable)
</CFIF>

Ken

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2006 Jun 15, 2006

Copy link to clipboard

Copied

LATEST
Just to add that, for consistency, it has to be '#FORM.Years#' and '2' or else #FORM.Years# and 2, depending on the datatype of the season column.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation