All pastes #1737 Raw Edit

zar

public text v1 · immutable
#1737 ·published 2004-10-27 17:23 UTC
rendered paste body
Let’s say I have a database with 2 tables like this:

 

First Table name: «Article»

 

+-----+--------------------+---------------------+

| ref   | contenu_titre | date_created  |

+-----+--------------------+---------------------+

 | 10  |  “Titre 1”        |   2004-01-02  |

+-----+--------------------+---------------------+

| 11 |  “Titre 2”        |   2004-02-02    |

+-----+--------------------+---------------------+

| 10  |  “Titre 3”        |   2004-03-02   |

+-----+--------------------+---------------------+

 

Second Table name :  «Colloque»

 

+-----+--------------------+---------------------+-------------------+

| ref   | contenu_titre | date_created  |  special_row  |

+-----+--------------------+---------------------+-------------------+

 | 10  |  “Titre 1”        |   2004-01-02  |  blarg1          |

+-----+--------------------+---------------------+-------------------+

| 11 |  “Titre 2”        |   2004-02-02    |  blarg2          |

+-----+--------------------+---------------------+-------------------+

 

I want to do a SINGLE query that will give me, as a result :

 

+-----+--------------------+---------------------+-------------------+

| ref   | contenu_titre | date_created  |  special_row  |

+-----+--------------------+---------------------+-------------------+

 | 10  |  “Titre 1”        |   2004-01-02  |                     |

+-----+--------------------+---------------------+-------------------+

| 11  |  “Titre 2”        |   2004-02-02    |                     |

+-----+--------------------+---------------------+-------------------+

| 10  |  “Titre 3”        |   2004-03-02   |                     |

+-----+--------------------+---------------------+-------------------+

 | 10  |  “Titre 1”        |   2004-01-02  |  blarg1          |

+-----+--------------------+---------------------+-------------------+

| 11 |  “Titre 2”        |   2004-02-02    |  blarg2          |

+-----+--------------------+---------------------+-------------------+

 

I didn’t ordered it, but I would want those results ordered by date_created as well…

 

I think I have to use the JOIN function, but I can’t figure out how to make it happend…

Thanks!