rma.eugene Posted May 31, 2010 Share Posted May 31, 2010 Hey All, Any way to combine this ugliness? $query2 = ' Select ' . 'a.BodyLength,' . 'a.ContentType,' . 'a.CreatedById,' . 'a.Name,' . 'a.ParentId,' . 'a.SystemModstamp' . " from Attachment a WHERE ParentId = " . $where; $query3 = 'Select' . 'n.CreatedById,' . 'n.CreatedDate,' . 'n.OwnerId,' . 'n.ParentId,' . 'n.SystemModstamp,' . 'n.Title' . "from Note n WHERE ParentId = " . $where; thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/203468-combine-two-mysql-queries/ Share on other sites More sharing options...
premiso Posted May 31, 2010 Share Posted May 31, 2010 $query2 = ' Select ' . 'a.BodyLength,' . 'a.ContentType,' . 'a.CreatedById,' . 'a.Name,' . 'a.ParentId,' . 'a.SystemModstamp,' . 'n.CreatedById,' . 'n.CreatedDate,' . 'n.OwnerId,' . 'n.ParentId,' . 'n.SystemModstamp,' . 'n.Title' . " from Attachment a JOIN Note n ON n.ParentId = a.ParentId WHERE ParentId = " . $where; Quote Link to comment https://forums.phpfreaks.com/topic/203468-combine-two-mysql-queries/#findComment-1065914 Share on other sites More sharing options...
rma.eugene Posted May 31, 2010 Author Share Posted May 31, 2010 thanks! thats what I was looking to do. unfortunately... SoapFault exception: [sf:MALFORMED_QUERY] MALFORMED_QUERY: n.SystemModstamp,n.Title from Attachment a JOIN Note n ON n.ParentId = a.ParentId ^ ERROR at Row:1:Column:176 unexpected token: JOIN in D:\websites.... cant do 'join' with soap client?? Quote Link to comment https://forums.phpfreaks.com/topic/203468-combine-two-mysql-queries/#findComment-1065919 Share on other sites More sharing options...
premiso Posted May 31, 2010 Share Posted May 31, 2010 No clue. Never used the SOAP client. You can try this: $query2 = ' Select ' . 'a.BodyLength,' . 'a.ContentType,' . 'a.CreatedById,' . 'a.Name,' . 'a.ParentId,' . 'a.SystemModstamp,' . 'n.CreatedById,' . 'n.CreatedDate,' . 'n.OwnerId,' . 'n.ParentId,' . 'n.SystemModstamp,' . 'n.Title' . " from Attachment a, Note n WHERE n.ParentId = a.ParentId AND a.ParentId = " . $where; Quote Link to comment https://forums.phpfreaks.com/topic/203468-combine-two-mysql-queries/#findComment-1065920 Share on other sites More sharing options...
rma.eugene Posted June 1, 2010 Author Share Posted June 1, 2010 Sadly... SoapFault exception: [sf:MALFORMED_QUERY] MALFORMED_QUERY: Attachment a, Note n WHERE n.ParentId = a.ParentId AND a.ParentId = 'a045000000CTXumAAH' ^ ERROR at Row:1:Column:203 unexpected token: 'a.ParentId' in D:\websites... Seems like that should have worked. Guess I'll run two queries. shouldn't be too big an issue? thanks Quote Link to comment https://forums.phpfreaks.com/topic/203468-combine-two-mysql-queries/#findComment-1065923 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.