Page 1 of 2 12 LastLast
Results 1 to 20 of 32
  1. #1
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default SQL Display statement

    How do I display all data from table one and two? How would the statement look then?

  2. #2
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    That really depends on what you're trying to accomplish. I would suggest reading this page and the entire w3 sql tutorial.

  3. #3
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    Quote Originally Posted by Shoss View Post
    That really depends on what you're trying to accomplish. I would suggest reading this page and the entire w3 sql tutorial.
    My two tables are linked (has a realtionship) and I want to display all the information, thats is all the information in table1 and all the information in table2.

  4. #4
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    Ok, then that page that i linked you to should be exactly what you need - read about the different types of joins.

  5. #5
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    My code now looks like this:
    Java Code:
    displayMthd("All players","SELECT Table1.Player, Table1.Opponent, Table1.Date, Table2.Motto, Table2.Dateofbirth, Table.Placeofbirth, Table2.Member, Table2.Rank, Table2.Gender FROM Table1 INNER JOIN Table2 ON Table1.Player = Table2.Player ORDER BY Table1.Player");
    But it is stil giving me errors:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:151)
    	at Scorekeeper.access$000(Scorekeeper.java:10)
    	at Scorekeeper$1.actionPerformed(Scorekeeper.java:203)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2015)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2338)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    	at java.awt.Component.processMouseEvent(Component.java:6434)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    	at java.awt.Component.processEvent(Component.java:6199)
    	at java.awt.Container.processEvent(Container.java:2203)
    	at java.awt.Component.dispatchEventImpl(Component.java:4790)
    	at java.awt.Container.dispatchEventImpl(Container.java:2261)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4803)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4463)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
    	at java.awt.Container.dispatchEventImpl(Container.java:2247)
    	at java.awt.Window.dispatchEventImpl(Window.java:2674)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:662)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:252)
    	at SQL3.displayMthd(SQL3.java:51)
    	at SQL3.<init>(SQL3.java:16)
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:147)
    	... 30 more

  6. #6
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    Looks good, there's just a small mistype in your sql -

    Java Code:
    ...teofbirth, Table.Placeofbirth, Table2...
    should probably be

    Java Code:
    ...teofbirth, Table2.Placeofbirth, Table2...

  7. #7
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    Oh thank you!!! I now het the following errors:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: Column not found
    at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.j ava:151)
    at Scorekeeper.access$000(Scorekeeper.java:10)
    at Scorekeeper$1.actionPerformed(Scorekeeper.java:203 )
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2015)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2338)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:259)
    at javax.swing.AbstractButton.doClick(AbstractButton. java:376)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Bas icMenuItemUI.java:833)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mou seReleased(BasicMenuItemUI.java:877)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEven tMulticaster.java:289)
    at java.awt.Component.processMouseEvent(Component.jav a:6434)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
    at java.awt.Component.processEvent(Component.java:619 9)
    at java.awt.Container.processEvent(Container.java:220 3)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4790)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2261)
    at java.awt.Component.dispatchEvent(Component.java:46 16)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4803)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4463)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4393)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2247)
    at java.awt.Window.dispatchEventImpl(Window.java:2674 )
    at java.awt.Component.dispatchEvent(Component.java:46 16)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 662)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:90)
    Caused by: java.sql.SQLException: Column not found
    at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdb cResultSet.java:1849)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbc ResultSet.java:410)
    at SQL3.displayMthd(SQL3.java:62)
    at SQL3.<init>(SQL3.java:16)
    at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.j ava:147)
    ... 30 more

  8. #8
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    The error is telling you it can't find a column you specified in your sql. Double check your spelling and that all of the columns you are trying to get in your select statement exist in the tables in which you are looking for them.

  9. #9
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    Quote Originally Posted by Shoss View Post
    The error is telling you it can't find a column you specified in your sql. Double check your spelling and that all of the columns you are trying to get in your select statement exist in the tables in which you are looking for them.
    I have checked and double checked and double checked, and there is no spelling error and all the tables i want does exist.

  10. #10
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    Can you post the sets of columns in both of your tables and the sql query you are using now? There isn't much else i can help you with until i see the structure of your tables.

  11. #11
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    here is Table1 :
    Player Opponent Date
    Ping Pong YYYYMMDD

    Table2 :
    Motto Dateofbirth Placeofbirth Member Rank Player Gender
    er YYYYMMDD er er er Ping Male

    Java Code:
     public SQL3 ()throws SQLException
          {
             displayMthd("All players","SELECT Table1.Player, Table1.Opponent, Table1.Date, Table2.Motto, Table2.Dateofbirth, Table2.Placeofbirth, Table2.Member, Table2.Rank, Table1 INNER JOIN Table2 ON Table1.Player = Table2.Player ORDER BY Table1.Player");
          }

  12. #12
    Mr777 is offline Devil
    Join Date
    Nov 2011
    Location
    Pakistan
    Posts
    12
    Rep Power
    0

    Default Re: SQL Display statement

    Isn't * work in java?
    Why don't you try SELECT * FROM table1, table2 where (joins here) ?

  13. #13
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    Quote Originally Posted by Mr777 View Post
    Isn't * work in java?
    Why don't you try SELECT * FROM table1, table2 where (joins here) ?
    Then it gives the following errors:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation.
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:151)
    	at Scorekeeper.access$000(Scorekeeper.java:10)
    	at Scorekeeper$1.actionPerformed(Scorekeeper.java:203)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2015)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2338)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    	at java.awt.Component.processMouseEvent(Component.java:6434)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    	at java.awt.Component.processEvent(Component.java:6199)
    	at java.awt.Container.processEvent(Container.java:2203)
    	at java.awt.Component.dispatchEventImpl(Component.java:4790)
    	at java.awt.Container.dispatchEventImpl(Container.java:2261)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4803)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4463)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
    	at java.awt.Container.dispatchEventImpl(Container.java:2247)
    	at java.awt.Window.dispatchEventImpl(Window.java:2674)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:662)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:252)
    	at SQL3.displayMthd(SQL3.java:52)
    	at SQL3.<init>(SQL3.java:17)
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:147)
    	... 30 more

  14. #14
    Mr777 is offline Devil
    Join Date
    Nov 2011
    Location
    Pakistan
    Posts
    12
    Rep Power
    0

    Default Re: SQL Display statement

    The problem doesn't seem to be with the SQL query but the java files you have in your project directory. Trace the exception and find where it causes the problem.
    Like
    at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.j ava:151)

  15. #15
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    Oh no sorry, i frogt the WHERE part in the statement...The errors look like this now...Please disregard the last post
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '(INNER JOIN Table2 ON Table1.Player = Table2.Player)'.
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:151)
    	at Scorekeeper.access$000(Scorekeeper.java:10)
    	at Scorekeeper$1.actionPerformed(Scorekeeper.java:203)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2015)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2338)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    	at java.awt.Component.processMouseEvent(Component.java:6434)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    	at java.awt.Component.processEvent(Component.java:6199)
    	at java.awt.Container.processEvent(Container.java:2203)
    	at java.awt.Component.dispatchEventImpl(Component.java:4790)
    	at java.awt.Container.dispatchEventImpl(Container.java:2261)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4803)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4463)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
    	at java.awt.Container.dispatchEventImpl(Container.java:2247)
    	at java.awt.Window.dispatchEventImpl(Window.java:2674)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:662)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '(INNER JOIN Table2 ON Table1.Player = Table2.Player)'.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:252)
    	at SQL3.displayMthd(SQL3.java:52)
    	at SQL3.<init>(SQL3.java:17)
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:147)
    	... 30 more

  16. #16
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    Look at what the error is telling you

    Java Code:
    Syntax error (missing operator) in query expression '(INNER JOIN Table2 ON Table1.Player = Table2.Player)'
    So somewhere around that expression is where you should look to find whats wrong. Compare it with other examples and see what is different with your syntax. What does your query look like now?

    Isn't * work in java?
    Why don't you try SELECT * FROM table1, table2 where (joins here) ?
    * works, but really shouldn't be used for anything other than dev/bug testing. Table structures can change and that has the possibility of messing up your project completely.

  17. #17
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    Quote Originally Posted by Shoss View Post
    Look at what the error is telling you

    Java Code:
    Syntax error (missing operator) in query expression '(INNER JOIN Table2 ON Table1.Player = Table2.Player)'
    So somewhere around that expression is where you should look to find whats wrong. Compare it with other examples and see what is different with your syntax. What does your query look like now?



    * works, but really shouldn't be used for anything other than dev/bug testing. Table structures can change and that has the possibility of messing up your project completely.
    I tried it your way and it gave me errors. Here is my query now:
    Java Code:
    displayMthd("","SELECT * FROM table1,table2 where (INNER JOIN Table2 ON Table1.Player = Table2.Player)");
    And here is my errors:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '(INNER JOIN Table2 ON Table1.Player = Table2.Player)'.
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:151)
    	at Scorekeeper.access$000(Scorekeeper.java:10)
    	at Scorekeeper$1.actionPerformed(Scorekeeper.java:215)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2015)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2338)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    	at java.awt.Component.processMouseEvent(Component.java:6434)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    	at java.awt.Component.processEvent(Component.java:6199)
    	at java.awt.Container.processEvent(Container.java:2203)
    	at java.awt.Component.dispatchEventImpl(Component.java:4790)
    	at java.awt.Container.dispatchEventImpl(Container.java:2261)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4803)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4463)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
    	at java.awt.Container.dispatchEventImpl(Container.java:2247)
    	at java.awt.Window.dispatchEventImpl(Window.java:2674)
    	at java.awt.Component.dispatchEvent(Component.java:4616)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:662)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '(INNER JOIN Table2 ON Table1.Player = Table2.Player)'.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:252)
    	at SQL3.displayMthd(SQL3.java:54)
    	at SQL3.<init>(SQL3.java:18)
    	at Scorekeeper.menuItem8ActionPerformed(Scorekeeper.java:147)
    	... 30 more
    So I guess it has something to do with my INNER JOIN, but I don't know what can be wrong because I copied and pasted it from my database. That leaves only one thing that could be the problem: My relationships in my table...or something to do with my table itself.
    Or could it be something else?
    How can I get my database to you so you can see it?

  18. #18
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL Display statement

    I have looked again and again...I really do not know what is wrong...

  19. #19
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: SQL Display statement

    Like i said, look at an example and compare it with your statement.

    W3's example vs yours, what are the differences?
    Java Code:
    SELECT column_name(s)
      FROM table_name1
      INNER JOIN table_name2 
        ON table_name1.column_name=table_name2.column_name
    
    SELECT *
      FROM table1, table2 
      where 
      (INNER JOIN Table2 
        ON Table1.Player = Table2.Player)

  20. #20
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 12-01-2010, 07:35 PM
  2. Using the return statement to display a string
    By Hoverboy in forum New To Java
    Replies: 6
    Last Post: 11-17-2010, 10:22 AM
  3. Replies: 1
    Last Post: 05-31-2010, 09:46 AM
  4. Replies: 8
    Last Post: 12-29-2008, 08:12 AM
  5. Replies: 0
    Last Post: 01-04-2008, 10:32 AM

Posting Permissions

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