Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9063533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:01:23+00:00 2026-06-16T16:01:23+00:00

Im sure there is a way to pull the data from enswitch_mobile_users better then

  • 0

Im sure there is a way to pull the data from enswitch_mobile_users better then how I pull it in

Enswitch_User_ID, Os_Version, Phone_Type

So how can I improve and improve this query?

$sql = "SELECT Substring(purchase.`date`,12,8)               AS `Time`, 
                  purchase.`item`                                    AS `Package`,
                  Cast(Substring(purchase.`item`, 12) AS UNSIGNED)   AS `Credit`,
                  purchase.`user`                                    AS `Mobile_User_ID`,

                  (SELECT user_id FROM enswitch_mobile_users WHERE `Mobile_User_ID` = enswitch_mobile_users.`id`) AS `Enswitch_User_ID`,
                  (SELECT os_version FROM enswitch_mobile_users WHERE `Mobile_User_ID` = enswitch_mobile_users.`id`) AS `Os_Version`,
                  (SELECT phone_type FROM enswitch_mobile_users WHERE `Mobile_User_ID` = enswitch_mobile_users.`id`) AS `Phone_Type`,

                  (SELECT enswitch_id FROM enswitch_users WHERE `Enswitch_User_ID` = enswitch_users.`id`)  AS `Enswitch_ID`

                        FROM   (SELECT item, date, user
                                    FROM enswitch_android_purchases 
                                    UNION 
                                    SELECT item, date, user
                                    FROM enswitch_iphone_purchases) AS `purchase` 
                        WHERE Substring(purchase.`date`,1,10) = :date
                ORDER  BY `Time` DESC";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:01:24+00:00Added an answer on June 16, 2026 at 4:01 pm

    Try this:

    SELECT SUBSTRING(p.date,12,8) AS TIME, p.item AS Package, COUNT(1) AS Sales, 
           CAST(SUBSTRING(p.item, 12) AS UNSIGNED) AS Credit, p.user AS Mobile_User_ID, 
           e.user_id Enswitch_User_ID, e.os_version Os_Version, e.phone_type Phone_Type, 
           eu.enswitch_id Enswitch_ID
    FROM (SELECT item, DATE, USER FROM enswitch_android_purchases 
          UNION
          SELECT item, DATE, USER FROM enswitch_iphone_purchases) AS p 
    LEFT JOIN enswitch_mobile_users e ON p.user = e.id
    LEFT JOIN enswitch_users eu ON e.user_id = eu.id
    WHERE SUBSTRING(p.date,1,10) := DATE
    ORDER  BY TIME DESC;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure what this is called, but is there a way I can pull
not sure if there's an elegant way to acheive this: Data ID Ver recID
I'm sure there's some way to do this with the \defgroup, \addgroup and \@{
I'm pretty sure there is no way, but i'm putting this out there for
I'm pretty sure there must be a way to launch spotify iphone app from
I am sure there must be a relatively straightforward way to do this, but
I'm sure there's a clean way to do this, but I'm probably not using
I am sure there is no easy way to do this but I have
I'm pretty sure there is an easier way to do this that I'm missing
Hi I'm sure there is some way of doing what I want, but maybe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.