0
Using multiple dates in WHERE clause
New Here
,
/t5/coldfusion-discussions/using-multiple-dates-in-where-clause/td-p/592549
Jan 31, 2007
Jan 31, 2007
Copy link to clipboard
Copied
I have a multiple select box in a form. I am trying to select
records in SQL using the list that this form field produces. They
are dateTime values. How do I use this list in the WHERE clause of
my select statement?
TOPICS
Database access
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/using-multiple-dates-in-where-clause/m-p/592550#M54886
Jan 31, 2007
Jan 31, 2007
Copy link to clipboard
Copied
Generally the sql syntax is
where somefield in (value1, value2, etc)
Also, cfqueryparam has a list atribute that does nice things for you.
But if you are sending datetime values, you will have to get match right down to the second. That may or may not create a logic problem for you.
where somefield in (value1, value2, etc)
Also, cfqueryparam has a list atribute that does nice things for you.
But if you are sending datetime values, you will have to get match right down to the second. That may or may not create a logic problem for you.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/coldfusion-discussions/using-multiple-dates-in-where-clause/m-p/592551#M54887
Feb 01, 2007
Feb 01, 2007
Copy link to clipboard
Copied
Man, I really hate posting anywhere near Dan - I've been
watching his mastery for years. (Talk about the big leagues) But
here goes anyway...
I've gotten my little behind kicked by more than a view date issues, and I have basically gotten away from exact matches (unless you really need them).
I'd probably do something like this:
SELECT field1,field2...
WHERE datetime_column_in_db > (OR LTE,OR GT/LT) '#datetimeformatyoulike(form.datetimevalue1)#
Basically, finding records in RELATION to the form's datetime value has always been much easier for me.
And God (and Dan) have mercy on my soul...
I've gotten my little behind kicked by more than a view date issues, and I have basically gotten away from exact matches (unless you really need them).
I'd probably do something like this:
SELECT field1,field2...
WHERE datetime_column_in_db > (OR LTE,OR GT/LT) '#datetimeformatyoulike(form.datetimevalue1)#
Basically, finding records in RELATION to the form's datetime value has always been much easier for me.
And God (and Dan) have mercy on my soul...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/coldfusion-discussions/using-multiple-dates-in-where-clause/m-p/592552#M54888
Feb 01, 2007
Feb 01, 2007
Copy link to clipboard
Copied
And obviously don't forget your "FROM" statement (like I did)
:-)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
LATEST
/t5/coldfusion-discussions/using-multiple-dates-in-where-clause/m-p/592553#M54889
Feb 01, 2007
Feb 01, 2007
Copy link to clipboard
Copied
And, for multiple dates:
WHERE datetime_column_in_db > '#datetimeformatyoulike(form.datetimevalue1)# OR datetime_column_in_db > '#datetimeformatyoulike(formdatetimevalue2)# (ETC...)
WHERE datetime_column_in_db > '#datetimeformatyoulike(form.datetimevalue1)# OR datetime_column_in_db > '#datetimeformatyoulike(formdatetimevalue2)# (ETC...)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

