Jump to content

Combining queries


steve_large

Recommended Posts

Hi Barry,

Just getting back at it now. The quad replace was to cut all of the prices off of the end of the events. The tournament organizers didn't want people to publicly see what others had paid for events especially when we had different prices for early bird applications. Also, there needed to be last initial only on the names because of wanting to have privacy for the applicants. 

I tried your code and it worked fine for 18 but 5 remained unaffected. Could be because I have that join in there somehow. This seemed to be the problem that I had been having before. I need the join in order to restrict people on the list to only the people who's PayPal transactions have completed. 

Here is the whole thing

SELECT e.entry_id, field_id,                           
       CASE field_id                              
         WHEN 5 THEN CONCAT(SUBSTRING_INDEX(value, ' ',1), ' ', LEFT(SUBSTRING_INDEX(value,' ', -1), 1))                              
         WHEN 18 THEN  TRIM(SUBSTRING_INDEX(value, '-', 1))                              
         ELSE value                          
       END as value                   
       FROM wp_wpforms_entry_fields f                    
       JOIN wp_wpforms_entries e ON f.entry_id = e.entry_id                   
           WHERE field_id IN (5,16,13,18)                    
           AND e.status='completed'                   
           ORDER BY e.entry_id DESC;

as I have inserted your code below. Did I make a mistake or typo somewhere?

Steve

 

Link to comment
Share on other sites

Hi Barry,

OOPs! My bad. Must have been a cut and paste error. Everything seems to be working now. There are no middle names though as I guess you can't really include that as it is a variable thing. Tried using Stephen William Large and got Stephen L. Great stuff anyway as I could never seem to get both things working at the same time and my names would come out as Stephen W. Instead.

Thanks,

Steve

Link to comment
Share on other sites

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.