SQL Query

A

Aaron

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
 
M

Michael Pearson

This is sorta off topic, but here goes.

SELECT FileName
FROM REW_FILES
WHERE FILE_CREATED = @cDate
AND (FILE_MODIFIED = @mDate OR FILE_MODIFIED IS NULL)


Michael
 
D

Davíð Þórisson

emm,
what does the @ in the query mean?


Michael Pearson said:
This is sorta off topic, but here goes.

SELECT FileName
FROM REW_FILES
WHERE FILE_CREATED = @cDate
AND (FILE_MODIFIED = @mDate OR FILE_MODIFIED IS NULL)


Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top