PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > with using a field to join tables with ON()
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
with using a field to join tables with ON()

Réponse
 
LinkBack Outils de la discussion
Vieux 19/12/2007, 20h45   #1
kevin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut with using a field to join tables with ON()

Hi all, thanks for taking the time...

Here's a sample query:

SELECT a.*, p.* FROM author_information a
LEFT JOIN products p on (a.authors_id IN ( p.author_information_id ) )


p.author_information_id is a field comprised of multiple authors -- ie
"2,34,41".

I've also tried:
SELECT a.*, p.* FROM author_information a
LEFT JOIN products p on all (a.authors_id IN ( SELECT
products.author_information_id from products where
products.products_id = p.products_id))

Both are valid, but only return one author, not authors 2,34 & 41.
Incidentally, I've also tried joining author_information to products,
just a shot in the dark that didn't go anywhere either.

Hard coding the values LEFT JOIN.....on ( a.authors_id IN ( 2,34,41 ))
returns exactly what I'm looking for.

Can anyone point me in the right direction? Thanks,
  Réponse avec citation
Vieux 19/12/2007, 22h48   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with using a field to join tables with ON()

kevin wrote:
> Hi all, thanks for taking the time...
>
> Here's a sample query:
>
> SELECT a.*, p.* FROM author_information a
> LEFT JOIN products p on (a.authors_id IN ( p.author_information_id ) )
>
>
> p.author_information_id is a field comprised of multiple authors -- ie
> "2,34,41".
>
> I've also tried:
> SELECT a.*, p.* FROM author_information a
> LEFT JOIN products p on all (a.authors_id IN ( SELECT
> products.author_information_id from products where
> products.products_id = p.products_id))
>
> Both are valid, but only return one author, not authors 2,34 & 41.
> Incidentally, I've also tried joining author_information to products,
> just a shot in the dark that didn't go anywhere either.
>
> Hard coding the values LEFT JOIN.....on ( a.authors_id IN ( 2,34,41 ))
> returns exactly what I'm looking for.
>
> Can anyone point me in the right direction? Thanks,


http://del.icio.us/Captain_Paralytic/normalization


  Réponse avec citation
Vieux 21/12/2007, 17h47   #3
kevin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with using a field to join tables with ON()

On Dec 19, 2:48 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> kevin wrote:
> > Hi all, thanks for taking the time...

>
> > Here's a sample query:

>
> > SELECT a.*, p.* FROM author_information a
> > LEFT JOIN products p on (a.authors_id IN ( p.author_information_id ) )

>
> > p.author_information_id is a field comprised of multiple authors -- ie
> > "2,34,41".

>
> > I've also tried:
> > SELECT a.*, p.* FROM author_information a
> > LEFT JOIN products p on all (a.authors_id IN ( SELECT
> > products.author_information_id from products where
> > products.products_id = p.products_id))

>
> > Both are valid, but only return one author, not authors 2,34 & 41.
> > Incidentally, I've also tried joining author_information to products,
> > just a shot in the dark that didn't go anywhere either.

>
> > Hard coding the values LEFT JOIN.....on ( a.authors_id IN ( 2,34,41 ))
> > returns exactly what I'm looking for.

>
> > Can anyone point me in the right direction? Thanks,

>
> http://del.icio.us/Captain_Paralytic/normalization



Hahaha, ok, I know this is bad design, but I'm not being paid for
making his data better, I'm just doing a quickie module... And is
this even possible?
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h11.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12342 seconds with 11 queries