mercredi 25 février 2015

MySQL : Left Outer join with in clause integers

Table-A:

Each record in this table maintains the list of attached documents for a given user Each record in this table maintains the attached documents


Table-B:

Each record in this table represents single attached document for a given user. Table 2


I am trying to get list of all Table-B records for a given user along with Table-A records. Where Table-A supportingDocIds varchar column maintains the list of Table-B's PrimaryKey idAttachedDocs(INT) using a comma separated.


I tried below with no luck.



select a.*,w.month from attacheddocs a left join weeklyhrssummary w on a.idattacheddocs in (REPLACE(w.supportingDocIds, '\'', '')) where a.userId=w.userid and a.userId=138 ;


Any solutions will be appreciated. Thanks.


/Gopi

www.AlliBilli.com


Aucun commentaire:

Enregistrer un commentaire