|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi Friends,
I have a series of files for displaying News and Events. Each calls the function-- DisplayNews() This invokes the function-- XML_News This function creates an array: zarrRS = Retrieve_News() Retrieve_News does the SQL lookup: Function Retrieve_Index() '# returns an array of the index posts to be displayed Dim zstrSQL,tmpPage,zobjRS,zarrRS '-- basic elements query -- zstrSQL = "SELECT news.PostID, news.Title, news.PostedDate, news.Short, userInfo.UserName, categories.CategoryName FROM userInfo INNER JOIN (news INNER JOIN categories ON news.Category Like categories.Category) ON news.PostedBy Like userInfo.UserID" The database contains a Table named news, which has a date field "PostEnd" that I want to filter on. Can you tell me how to add this field to the query so I can show only results whose PostEnd dates are later than the current date? Thanks for any help you can offer. Brian www.phelpstek.com |
|
#2
|
|||
|
|||
|
Hi Brian,
I do not know what programming language you are using. Assuming that you are doing it in ASP, you can simply add the where clause to zstrSQL = statement as follows: zstrSQL = "SELECT news.PostID, news.Title, news.PostedDate, news.Short, userInfo.UserName, categories.CategoryName FROM userInfo INNER JOIN (news INNER JOIN categories ON news.Category Like categories.Category) ON news.PostedBy Like userInfo.UserID WHERE news.PostEnd > '" + CStr(Date()) + "'" If you are not using ASP, then probably you need to replace Date() and CStr functions with the appropriate functions in the particular language that you are using. Hope this solves the problem. Regards, Vikram |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Need to add filter to SQL Query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|