Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    10

    Unanswered: Querying with Java

    I'm writing this Java application that queries a database, and my database involves a query that goes


    "SELECT uni_list.university, major_list.major
    FROM (major_list INNER JOIN uni_major ON major_list.id = uni_major.major_id) INNER JOIN uni_list ON uni_major.uni_id = uni_list.id
    WHERE (((major_list.major) Like "*business*"));"

    what I came up with is
    String major = "Business";

    ResultSet rs1=stmt1.executeQuery("select uni_list.university, major_list.major FROM (major_list INNER JOIN uni_major ON major_list.id = uni_major.major_id) INNER JOIN uni_list ON uni_major.uni_id = uni_list.id uni_list where major_list.major like '%"+major+"%'");

    I get the error "[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'uni_major.uni_id = uni_list.id uni_list'."

    any assistance?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    ResultSet rs1=stmt1.executeQuery("select uni_list.university, major_list.major FROM (major_list INNER JOIN uni_major ON major_list.id = uni_major.major_id) INNER JOIN uni_list ON uni_major.uni_id = uni_list.id uni_list where major_list.major like '%"+major+"%'");

    remove word in red
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2006
    Posts
    10
    hehe already got it, thanks again bro

Posting Permissions

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