Database Search

Results 1 to 2 of 2

Thread: Database Search

  1. #1
    Join Date
    Dec 1969

    Default Database Search

    Hi! I have a database with one table where I store articles about different sports. I have these fields in my database:<BR><BR>searchwords - separated by commas<BR>heading - the heading of the article<BR>writer - the writer<BR>text - the article itself<BR>category - the sport <BR><BR>I would like to have a search function where you either could search in a specific sport or through all articles by searchwords. So that if you wrote referee you would get all article with the word in either the searchwords, text or heading back as a result. Is it anyone that have any tips about what SQL I should use.<BR><BR>Thanks in advance/Fredrik Nilsson

  2. #2
    Join Date
    Dec 1969

    Default RE: Database Search

    You&#039ll probably want to use the LIKE keyword. An example would be:<BR><BR>Select * From table1<BR>Where column1 LIKE &#039%football%&#039<BR><BR>This will return all rows where the word football appears anywhere in field column1. The % tells the LIKE clause to match any number of characters in that position. In other words, if you use LIKE &#039football%&#039, it will only match if the field starts with football, since there is no leading %.<BR><BR>Hope this helps.

Posting Permissions

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