Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 7.90 KB | None | 0 0
  1. use sgp_lite_api;
  2.  
  3.  
  4. select auca.id from sgp_lite_accounts_applicationuser au
  5. join sgp_lite_accounts_applicationusercustomeraccount auca on au.id = auca.application_user_id
  6.   join sgp_lite_tests_test test on auca.id = test.owner_id
  7. where au.email='ensinomedio@colegionaturezaararaquara.com.br';
  8.  
  9. show COLUMNS  from sgp_lite_tests_test;
  10. # -----------------------------------------------------------------
  11.  
  12. SELECT aa.username, aa.first_name, aa.last_name, cac.member_date
  13. FROM sgp_lite_accounts_applicationuser aa
  14.     INNER JOIN sgp_lite_accounts_applicationusercustomeraccount aacu ON aa.id = aacu.application_user_id
  15.         AND aacu.type_id = 2
  16.     INNER JOIN sgp_lite_customer_account_customeraccount cac ON aacu.customer_account_id = cac.id
  17. WHERE
  18.     cac.member_date BETWEEN '2017-07-07' AND '2017-07-14';
  19.  
  20.  
  21. SELECT aa.username, aa.first_name, aa.last_name, cac.member_date, COUNT(DISTINCT ttr.id) as digitalizacoes
  22. FROM sgp_lite_accounts_applicationuser aa
  23.     INNER JOIN sgp_lite_accounts_applicationusercustomeraccount aacu ON aa.id = aacu.application_user_id
  24.     INNER JOIN sgp_lite_customer_account_customeraccount cac ON aacu.customer_account_id = cac.id
  25.     INNER JOIN sgp_lite_tests_testresult ttr ON aacu.id = ttr.owner_id
  26. WHERE
  27.     aacu.id NOT IN (
  28.         SELECT DISTINCT aacu.id FROM sgp_lite_accounts_applicationusercustomeraccount aacu
  29.             INNER JOIN sgp_lite_tests_testresult ttr2 ON aacu.id = ttr2.owner_id
  30.         WHERE
  31.             aacu.type_id = 2 AND ttr2.creation_date < '2017-07-07'
  32.     ) AND ttr.creation_date BETWEEN '2017-07-07' AND '2017-07-14'
  33. GROUP BY aa.username
  34. HAVING
  35.     digitalizacoes >= 10;
  36.  
  37.  
  38.  
  39.         SELECT aa.id, aa.username, aa.first_name, aa.last_name, cac.member_date
  40.         FROM sgp_lite_accounts_applicationuser aa
  41.             INNER JOIN sgp_lite_accounts_applicationusercustomeraccount aacu ON aa.id = aacu.application_user_id
  42.                 AND aacu.type_id = 2
  43.             INNER JOIN sgp_lite_customer_account_customeraccount cac ON aacu.customer_account_id = cac.id
  44.         WHERE
  45.             cac.member_date BETWEEN '2017-07-07' AND '2017-07-14';
  46.  
  47.  
  48. SELECT aa.id, aa.username, aa.first_name, aa.last_name, cac.member_date, COUNT(DISTINCT ttr.id) as digitalizacoes
  49. FROM sgp_lite_accounts_applicationuser aa
  50.     INNER JOIN sgp_lite_accounts_applicationusercustomeraccount aacu ON aa.id = aacu.application_user_id
  51.     INNER JOIN sgp_lite_customer_account_customeraccount cac ON aacu.customer_account_id = cac.id
  52.     INNER JOIN sgp_lite_tests_testresult ttr ON aacu.id = ttr.owner_id
  53. WHERE
  54.     aacu.id NOT IN (
  55.         SELECT DISTINCT aacu.id FROM sgp_lite_accounts_applicationusercustomeraccount aacu
  56.             INNER JOIN sgp_lite_tests_testresult ttr2 ON aacu.id = ttr2.owner_id
  57.         WHERE
  58.             aacu.type_id = 2 AND ttr2.creation_date < '2017-07-07'
  59.     ) AND ttr.creation_date BETWEEN '2017-07-07' AND '2017-07-14'
  60. GROUP BY aa.username
  61. HAVING
  62.     digitalizacoes >= 10;
  63.  
  64.  
  65.  
  66.  
  67. # --------------------------------------------------------------------
  68. SELECT aa.id, aa.username, aa.first_name, aa.last_name, aacu.id as owner_id, cac.id, cacp.name, caca.subscription_id,
  69.     caca.status_id, caca.*, cacac.*
  70. FROM sgp_lite_accounts_applicationuser aa
  71.     INNER JOIN sgp_lite_accounts_applicationusercustomeraccount aacu ON aa.id = aacu.application_user_id AND aacu.type_id = 2
  72.     INNER JOIN sgp_lite_customer_account_customeraccount cac ON aacu.customer_account_id = cac.id
  73.     INNER JOIN sgp_lite_customer_account_customeragreement caca ON cac.id = caca.customer_account_id
  74.     INNER JOIN sgp_lite_customer_account_accountplan cacp ON caca.account_plan_id = cacp.id
  75.     LEFT JOIN sgp_lite_customer_account_customeragreementcredit cacac ON caca.id = cacac.customer_agreement_id
  76. WHERE
  77.     aa.username LIKE '%compras@maededeus.edu.br%'
  78. ORDER BY caca.id;
  79.  
  80.  
  81. select aca.id from sgp_lite_accounts_applicationuser au
  82. join sgp_lite_accounts_applicationusercustomeraccount aca on au.id = aca.application_user_id
  83. where email='ccantai@hotmail.com';
  84.  
  85. select * from sgp_lite_settings_apiauditlog where owner_id=1795 and type_audit='error' ORDER BY id desc limit 100;
  86.  
  87.  
  88. select ca.name as 'CA', ca.id as 'CA ID', auca.id as 'AUCA', au.email as 'AU EMAIL' from sgp_lite_accounts_applicationusercustomeraccount auca
  89. join sgp_lite_accounts_applicationuser au on auca.application_user_id = au.id
  90. join sgp_lite_customer_account_customeraccount ca on auca.customer_account_id = ca.id
  91. where au.email="dallazsnandreia@gmail.com";
  92.  
  93. select auca.id, au.email, auca.type_id from sgp_lite_customer_account_customeraccount ca
  94.     join sgp_lite_accounts_applicationusercustomeraccount auca on ca.id = auca.customer_account_id
  95.     join sgp_lite_accounts_applicationuser au on auca.application_user_id = au.id
  96. # where au.id in (24421, 24917, 24503, 24004, 24567, 24370) limit 20;
  97. where ca.id=21150 limit 20;
  98.  
  99. select * from sgp_lite_accounts_applicationuser where email='ccantai@hotmail.com';
  100. select * from sgp_lite_customer_account_customeraccount where id=21150;
  101.  
  102. SELECT aa.id, COUNT(DISTINCT csuc.id) as total_content FROM sgp_lite_accounts_applicationuser aa
  103. INNER JOIN sgp_lite_content_structure_applicationusercontent aac ON aa.id = aac.user_id
  104. INNER JOIN sgp_lite_content_structure_usercontent csuc ON aac.content_id = csuc.id
  105. INNER JOIN sgp_lite_content_structure_usercontentconfig casuc ON csuc.content_config_id = casuc.id
  106. WHERE
  107. casuc.`order` = 1
  108. GROUP BY aa.id
  109. HAVING total_content > 1
  110. ORDER BY aa.id;
  111.  
  112. SELECT aa.id, csuc.parent_id, csuc.id, csuc.name FROM sgp_lite_accounts_applicationuser aa
  113. INNER JOIN sgp_lite_content_structure_applicationusercontent aac ON aa.id = aac.user_id
  114. INNER JOIN sgp_lite_content_structure_usercontent csuc ON aac.content_id = csuc.id
  115. INNER JOIN sgp_lite_content_structure_usercontentconfig casuc ON csuc.content_config_id = casuc.id
  116. WHERE
  117. aa.id in (
  118.     7,
  119.     12,
  120.     330,
  121.     389,
  122.     402,
  123.     1257,
  124.     2307,
  125.     4180,
  126.     7051,
  127.     8455
  128. )
  129. ORDER BY aa.id;
  130.  
  131. use sgp_lite_api;
  132.  
  133.  
  134. -- Achar o owner_id
  135. select au.username, aca.id, aca.customer_account_id, au.id, aca.type_id from sgp_lite_accounts_applicationuser au
  136. join sgp_lite_accounts_applicationusercustomeraccount aca on au.id = aca.application_user_id
  137. where au.username LIKE '%pedrovsc@unipar.br%' limit 10;
  138. # where aca.id=5822;
  139.  
  140. select t.name from sgp_lite_tests_testresult tr
  141.     join sgp_lite_academic_student st on tr.student_id = st.id
  142.     join sgp_lite_tests_test t on tr.test_id = t.id
  143. where tr.owner_id=25451 and st.register_id=123456789;
  144. # and t.name like "%JF-MTC NOT%";
  145.  
  146. select * from sgp_lite_tests_testresult
  147.     where owner_id=25451 and student_read_id=123456789;
  148.  
  149. show COLUMNS from sgp_lite_settings_apiauditlog;
  150.  
  151. select * from sgp_lite_settings_apiauditlog where
  152. #     owner_id=25451 and message like "%studentsync%" and message like "%170200072%" ORDER BY id desc limit 10;
  153.     type_audit != 'info' and owner_id=5822 ORDER BY id desc limit 10;
  154.  
  155.  
  156.  
  157. select * from sgp_lite_tests_testresult where sync_id="35a9f68a-e87e-45d2-98d3-e5205a14556e";
  158.  
  159. select * from authtoken_token where user_id=5918;
  160.  
  161. select * from sgp_lite_accounts_applicationuser where email like "%unipar.br%";
  162.  
  163. select cag.* from sgp_lite_customer_account_customeragreement cag
  164. join sgp_lite_customer_account_customeraccount ca on cag.customer_account_id = ca.id
  165. join sgp_lite_accounts_applicationusercustomeraccount apuca on ca.id = apuca.customer_account_id
  166. where apuca.id=10098;
  167.  
  168. select * from sgp_lite_customer_account_accountplan;
  169.  
  170.  
  171. Select * from sgp_lite_tests_test tr
  172. join sgp_lite_accounts_applicationusercustomeraccount apuca on tr.owner_id = apuca.id
  173. # SET s.record_status = 2, s.last_modification = NOW()
  174. where tr.record_status=1 and apuca.customer_account_id=10048;
  175.  
  176. UPDATE sgp_lite_tests_test tr
  177. join sgp_lite_accounts_applicationusercustomeraccount apuca on tr.owner_id=apuca.id
  178. SET tr.record_status = 2, tr.last_modification = NOW()
  179. where tr.record_status=1 and apuca.customer_account_id=10048;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement