Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/203468-combine-two-mysql-queries/
Share on other sites

   $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;

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??

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;

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.