Results 1 to 4 of 4

Thread: search query

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    140

    search query

    Hi!
    Could anyone please help with a search query!
    I am creating a query which searches the records from one particular date to other with respect to a category.
    And also i have other fields which needs to searched by category.

    I have created a statement but it is not searchin w.r.t to category
    Suppose if a user a enters a keyword the query searches in 2 fields but w.r.t the CATEGORY
    but my query displays all the records w.r.t the Keyword.

    "SELECT * FROM t_main " _
    & " where f_title LIKE '%" & Replace(vartext, "'", "''") & "%' " _
    & "OR f_title LIKE '%" & Replace(vartext, "'", "''") & "%' " _
    & "OR f_desc LIKE '%" & Replace(vartext, "'", "''") & "%' " _
    & "AND f_catid="& varc &" "_
    & "AND f_cdate>='"& varafd &"' " _
    & "AND f_cdate<='"& varatd &"' " _
    & "ORDER BY f_cdate;"

    I am stuck where i am getting wrong!
    Please help!
    Thank you.

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    what is w.r.t.???
    I don't understand what you're wanting?
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Memnoch:

    wrt = with respect to.



    neo:

    I understood the "wrt" part, but not what you're trying to accomplish. SQL seems fine. Give a more elaborate example so that us dumb ones can understand better.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    140
    Hi!
    I have attached a screen shot of the same to have a brief idea.
    Here the user selects a category(Nature of the Document) and from which date he wants to search by filling from date and to date fields.
    THe above query picks up the data with respect to the keyword instead of the category first.
    I hope i explained it clear.
    Please please help.
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width