Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    Denmark
    Posts
    2

    Post Unanswered: MySQL query join problem

    I have a problem writing the SQL manually.

    Im trying to get the same output in MySQL.

    that im getting here -> http://www.webdecor.dk/gfx/db_tbl.gif

    But the SQL you here is generated by SQL Server and it doesnt work in MySQL.

    Can someone tell me how to do it, I have been trying and trying...

  2. #2
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137

    Re: MySQL query join problem

    You need to specify the ON clause of the join syntax before specifying a new join, if I am not mistaken. For instance, instead of using
    Code:
    RIGHT OUTER JOIN theater INNER JOIN row...
    You need to use:
    Code:
    RIGHT OUTER JOIN theater ON eventshow.Theater_ID = theater.IDNR
    INNER JOIN row ON row.Theater_ID = theater.IDNR
    The table structure shown in the diagram does not look optimal. You probably want to rethink the query. Maybe something like this:

    Code:
    SELECT ...
    FROM seat_reservation
    INNER JOIN status ON status.IDNR = seat_reservation.status_id
    RIGHT JOIN seat ON seat_reservation.seat_id = seat.IDNR
    INNER JOIN row ON seat.row_id = row.IDNR
    INNER JOIN theater ON row.theater_ID = theater.IDNR
    INNER JOIN eventshow ON theater.IDNR = eventshow.theater_id
    WHERE eventshow.IDNR = 1 AND eventshow.theater_id = 1;

  3. #3
    Join Date
    Dec 2003
    Location
    Denmark
    Posts
    2

    Got it fixed

    Hi there, I got it fixed.

Posting Permissions

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