Results 1 to 8 of 8
  1. #1
    kichkich is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default Retrieve data from other table

    Hi,
    I have 2 tables contain data
    how can i retrieve from 2nd table data by using 1st table id which z primary key in 1st table and forn key to 2nd table..
    plz help me...

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Quote Originally Posted by kichkich View Post
    Hi,
    I have 2 tables contain data
    how can i retrieve from 2nd table data by using 1st table id which z primary key in 1st table and forn key to 2nd table..
    plz help me...
    What's a 'z primary key'?

    db

  3. #3
    kichkich is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default

    file
    id z primary key..

  4. #4
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    do not shortcut words like forn which you mean is foreign?

    Honestly cannot understand what you are trying to say.

  5. #5
    kichkich is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default

    foreign key

  6. #6
    kichkich is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default

    INSERT INTO "SYSTEM"."STYLE_TAX_HOLIDAY"("FILE_ID", "STYLE_CD", "ID_DPT_PS", "DE_STYLE", "STYLE_SC", "NM_CRT", "TS_CRT", "NM_UPDT_LS")
    VALUES(305, '17', " '22' '34' '54' ", 'chips', " 'I','E', 'I' ", 'BISWAJIT', TO_TIMESTAMP('1996-11-21 00:00:00:0','YYYY-MM-DD HH24:MI:SS:FF'), 'BISWAJIT');


    how can i insert multiple values in to the column "ID_DPT_PS"..
    STYLE_SC....

  7. #7
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    You mean only field ID_DPT_PS only change?
    See Using Prepared Statements (The Java™ Tutorials > JDBC(TM) Database Access > JDBC Basics)

    You might want to search for "Database Normalization", this site also explain database normalization well, for me, 3 Normal Forms Database Tutorial

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default

    For your first problem, you want to learn SQL. Look up JOIN.

    For your second problem, PreparedStatement and batch. Should be in that link mine0926 posted.
    If there's loads (ie a file) then I would look into using whatever bulk import utility your db came with.

Similar Threads

  1. How do I retrieve data based on user input?
    By tunali2 in forum New To Java
    Replies: 1
    Last Post: 04-03-2011, 02:40 PM
  2. how to retrieve data when i select the input from the form
    By sharanya in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 03-08-2011, 10:39 AM
  3. how to retrieve data from other jtable..
    By javanewbie2010 in forum AWT / Swing
    Replies: 1
    Last Post: 02-12-2010, 08:32 AM
  4. speeder way to store and retrieve data
    By Ms.Ranjan in forum New To Java
    Replies: 3
    Last Post: 04-21-2009, 05:54 PM
  5. How to retrieve data from servlet
    By valery in forum Java Servlet
    Replies: 1
    Last Post: 08-06-2007, 08:25 PM

Posting Permissions

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