Hello everyone,

Can someone please help with this.  I'm porting my work from Mssql to 
MySQL I need some syntax help. My query takes fields from three tables 
but it also needs an INNER JOIN between two tables. I have the following :

Table 1:
Mysql> select * from table_1;
================================
Catalog_id format
------------------------------
1    Format_1
2    Format_2
==============================

Mysql> select * from table_2; (In this table -1 indicates it should 
match any and all values of chapter_id)

==============================================================
catalog_id      section_id  chapter_id  section_name
---------------------------------------------------------------
1    1       -1      Name 1
1    2       -1      Name 2
===============================================================

Mysql> select * from table_3;
============================================
catalog_id      section_id  chapter_id
--------------------------------------------
1    1       1
1    1       2
1    1       3
1    2       1
1    2       2
1    2       3
1    3       1
1    3       2
============================================
I need a query that will give me the following result.  I've done this 
in Mssql with an inner join between table_2 and table_3 on section_id 
and chapter_id.  But I'm having problems getting the right results in 
MySQL.  Your help will be much appreciated.
==================================================================
catalog_id  section_id  chapter_id  Section_name    format
------------------------------------------------------------------
1    1   1       Name 1    Format_1
1    1   2       Name 1    Format_1
1    1   3       Name 1    Format_1
1    2   1       Name 2    Format_1
1    2   2       Name 2    Format_1
1    2   3       Name 2    Format_1
1    3   1               Format_1
1    3   2               Format_1
==================================================================

thanks in advance
Leila


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to