SQL query question

shwaipshwaip bluffin' with my muffin Icrontian
edited October 2003 in Internet & Media
My CS220 project is to build a java program that interacts with a database somehow. Our project basically queries a pre-built database. I got stuck with the code-bitch role (the rest of my group aren't too good at it).

I've gotten most of the queries that I want to work, but I cannot make a filename search that does not match exactly. It takes a string from the user, and creates a query using that. I've tried the using the asterisk as a wildcard, but it does not seem to work. The book that was reccomended for the class did not address this topic, or I just cannot find it. Help meh pls!

Comments

  • a2jfreaka2jfreak Houston, TX Member
    edited October 2003
    You are using LIKE, right?

    SELECT * WHERE field LIKE "%blah"
    Or whatever suits your needs.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited October 2003
    Like (heh) I said the book sucked, so there was no mention of "LIKE". Thanks, I'll try that now

    //
    Thanks, it works fine.

    This is definitely the worst taught class I've ever been in. The teacher told us what we had to do, but not how (I understand that happens in the real world, but hey, he's actually supposed to teach us stuff :D), and that everything we needed to know would be in that book. But...meh, what can you do :)
  • a2jfreaka2jfreak Houston, TX Member
    edited October 2003
    Welcome
  • EnverexEnverex Worcester, UK Icrontian
    edited October 2003
    You'll want to use

    Select BLAH from BLAH where BLAH = BLAH

    too, if you want to pick something out specifically. The %'s are wildcards like * normally. I.e. "Like %Blah" will find eggyblah and blah but not blahstable, opposite with blah%, it will find blashstabe and blah, but not happyblah.

    NS
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited October 2003
    Thx NS, but that was in the book :).
Sign In or Register to comment.