Thread: SQL Query

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    26
    Rep Power
    0
    A real simple question, but need some guidance here.

    I want to create a narrowed search that queries a database of institutions based on user preferences. I have a field called MAJORS, which is longtext, and it contains a list of majors, separated by newlines. I want to be able to allow a user to input a certain major "Computer Science", lets say, and the query should be able to search within that longtext for "Computer Science".

    The normal query structure, select * from table where blabla like blabla, doesn't seem to work.

    How can I do this?

    Thanks,
    Sana
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    That depends on the SQL engine you are using. In MySQL you can use wildcards with the LIKE operator:

    select * from table where column LIKE '%something%';

    The % is the wildcard operator.

Similar Threads

  1. need SQL help - one query or multiples
    By coach in forum MySQL Help
    Replies: 5
    Last Post: February 16th, 2004, 08:39 AM
  2. sql query
    By ironchef in forum Database Management
    Replies: 2
    Last Post: January 4th, 2004, 10:44 PM
  3. Replies: 1
    Last Post: December 19th, 2003, 10:12 AM
  4. Show SQL Query in browser for testing
    By playaz in forum ASP Programming
    Replies: 2
    Last Post: December 7th, 2003, 08:45 AM
  5. passing sql query through querystring
    By buckenmeyer in forum PHP Development
    Replies: 3
    Last Post: December 6th, 2003, 02:09 PM

IMN logo majestic logo threadwatch logo seochat tools logo