SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: SQL Problem

  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question SQL Problem

    I need your assistance on a problem that I need to
    solve a work related problem.
    Please let me know if I did anything wrong in this
    below SQL:
    This is about Insert two tables fields into an other
    new table.
    #######################################################
    INSERT INTO Booking_Sentence
    (person_id, booking_number,
    total_term_days, total_term_months, total_term_years,

    tentative_release_date, sentence_start_date)
    SELECT JMS_HSDCHAR.INMATE_KEY,
    JMS_HSDCHAR.CHRG_KEY, JMS_HSDCHAR.DAYS_SENT,
    JMS_HSDCHAR.MTHS_SENT,

    JMS_HSDCHAR.YRS_SENT,
    JMS_HSDMAST1.SRD,
    JMS_HSDMAST1.SENTENCE_DATE
    FROM JMS_HSDCHAR CROSS JOIN
    JMS_HSDMAST1

    #######################################################
    I sincerely appreciate your help

    Best Regards,

    Christine

  2. #2
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Christine,

    when you run it does it show an error?

    Also, what version of MySQL are you using? The reason I ask is that the insert into select construct you are using is not supported on some versions of MySQL.

    Mike

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Christine, your query looks okay to me

    why do you think there's something wrong? did the query do what you want? did it run? did it produce an error message? what was the error message?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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