473,395 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

SQL Query

My db table looks like this
FILENAME FILE_CREATED FILE_MODIFIED
test 9/12
test2 9/13 10/13
..
..
all FILE_CREATED field have value, only some FILE_MODIFIED have value.

I need to get the value of FILENAME column and this is what i have

SELECT FILENAME FROM REW_FILES WHERE FILE_CREATED =@cDate AND
FILE_MODIFIED = @mDate

This problem with this query is that it would return null if the
FILE_MODIFIED field is empty.

How can I write a query that ignores " AND FILE_MODIFIED = @mDate" if
FILE_MODIFIED is null?

Thanks
Jul 21 '05 #1
3 1232
Hi Aaron,

If I understand properly:
SELECT FILENAME FROM REW_FILES WHERE FILE_CREATED =@cDate AND (FILE_MODIFIED
= @mDate OR FILE_MODIFIED IS NULL)

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com
"Aaron" <ku*****@yahoo.com> wrote in message
news:b4**************************@posting.google.c om...
My db table looks like this
FILENAME FILE_CREATED FILE_MODIFIED
test 9/12
test2 9/13 10/13
.
.
all FILE_CREATED field have value, only some FILE_MODIFIED have value.

I need to get the value of FILENAME column and this is what i have

SELECT FILENAME FROM REW_FILES WHERE FILE_CREATED =@cDate AND
FILE_MODIFIED = @mDate

This problem with this query is that it would return null if the
FILE_MODIFIED field is empty.

How can I write a query that ignores " AND FILE_MODIFIED = @mDate" if
FILE_MODIFIED is null?

Thanks

Jul 21 '05 #2
SELECT FILENAME FROM REW_FILES WHERE (FILE_CREATED =@cDate AND
FILE_MODIFIED = @mDate) OR File_Created=@cDate
"Aaron" <ku*****@yahoo.com> wrote in message
news:b4**************************@posting.google.c om...
My db table looks like this
FILENAME FILE_CREATED FILE_MODIFIED
test 9/12
test2 9/13 10/13
.
.
all FILE_CREATED field have value, only some FILE_MODIFIED have value.

I need to get the value of FILENAME column and this is what i have

SELECT FILENAME FROM REW_FILES WHERE FILE_CREATED =@cDate AND
FILE_MODIFIED = @mDate

This problem with this query is that it would return null if the
FILE_MODIFIED field is empty.

How can I write a query that ignores " AND FILE_MODIFIED = @mDate" if
FILE_MODIFIED is null?

Thanks

Jul 21 '05 #3
On 30 Dec 2003 14:36:03 -0800, ku*****@yahoo.com (Aaron) wrote:
My db table looks like this
FILENAME FILE_CREATED FILE_MODIFIED
test 9/12
test2 9/13 10/13
.
.
all FILE_CREATED field have value, only some FILE_MODIFIED have value.

I need to get the value of FILENAME column and this is what i have

SELECT FILENAME FROM REW_FILES WHERE FILE_CREATED =@cDate AND
FILE_MODIFIED = @mDate

This problem with this query is that it would return null if the
FILE_MODIFIED field is empty.

How can I write a query that ignores " AND FILE_MODIFIED = @mDate" if
FILE_MODIFIED is null?


You might want to rethink what you are asking for. Why would you ask
for a file that was created on date X and modified on date Y, but want
to see one that was never modified? How would you know a date to
search for in the Modified column if it was not modified? Im thinking
maybe what you are looking for is some code that will handle a case
where the value you are passing in for the Modified column is "null".
Is this the case?

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
14
by: Dave Thomas | last post by:
If I have a table set up like this: Name | VARCHAR Email | VARCHAR Age | TINYINT | NULL (Default: NULL) And I want the user to enter his or her name, email, and age - but AGE is optional. ...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
3
by: Bill Hutchison | last post by:
I have a query that returns different results (3508 rows for snapshot, 6288 for dynaset) and that is the only thing I change to get the different results. When I try to make a table from the...
3
by: pbd22 | last post by:
Hi. I need some help with structuring my query strings. I have a form with a search bar and some links. Each link is a search type (such as "community"). The HREF for the link's anchor looks...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.