daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT DISTINCT
  2.   sql_no_cache as job.id,
  3.   job.id as job_id,
  4.   job.job_status,
  5.   job.servee_name,
  6.   kase.plaintiff,
  7.   index_number,
  8.   lawfirm_filenumber,
  9.   DATE_FORMAT(job.datetime_received, '%m/%d/%Y') as date_received,
  10.   DATE_FORMAT(job.date_sent_to_court, '%m/%d/%Y') as date_sent_to_court,
  11.   DATE_FORMAT(kase.date_kase_filed, '%m/%d/%Y') as date_kase_filed,
  12.   TO_DAYS(NOW())-TO_DAYS(kase.date_kase_filed) as thedays,
  13.   DATE_FORMAT(kase.court_datetime, '%m/%d/%Y %h:%i %p') as court_date,
  14.   kase.court_room,
  15.   CONCAT( LUcourt.court_county," - ",LUcourt.court_type) as court_name,
  16.   DATE_FORMAT( job.datetime_served, '%m/%d/%Y') as datetime_served,
  17.   CONCAT( server.namefirst,' ', server.namelast) as server_name
  18.  
  19. FROM      job
  20. LEFT JOIN kase        ON job.kase_id = kase.id
  21. LEFT JOIN kasebilling ON kasebilling.kase_id = kase.id
  22. LEFT JOIN server      ON job.server_id = server.id
  23. LEFT JOIN client      ON client.id     = kase.client_id
  24. LEFT JOIN LUcourt     ON LUcourt.id    = kase.court_id
  25.  
  26.    WHERE job.subscriber_id = 1
  27. ORDER BY job_id + 0
  28.    LIMIT 0,500;
  29.  
  30. </pre>
  31. i modified the query but it wont run ...
  32.  
  33.     SELECT DISTINCT sql_no_cache  job.id, job.id as job_id, job.job_status, job.servee_name, kase.plaintiff, index_number, lawfirm_filenumber, DATE_FORMAT(job.datetime_received, '%m/%d/%Y') as date_received, DATE_FORMAT(job.date_sent_to_court, '%m/%d/%Y') as date_sent_to_court, DATE_FORMAT(kase.date_kase_filed, '%m/%d/%Y') as date_kase_filed, TO_DAYS(NOW())-TO_DAYS(kase.date_kase_filed) as thedays, DATE_FORMAT(kase.court_datetime, '%m/%d/%Y %h:%i %p') as court_date, kase.court_room, CONCAT(LUcourt.court_county," - ",LUcourt.court_type) as court_name, DATE_FORMAT(job.datetime_served, '%m/%d/%Y') as datetime_served, concat(server.namefirst,' ', server.namelast) as server_name FROM job
  34.     LEFT JOIN kase ON job.kase_id = kase.id
  35.     LEFT JOIN kasebilling  ON kasebilling.kase_id = kase.id
  36.     LEFT JOIN server ON job.server_id = server.id
  37.     left join client on client.id=kase.client_id
  38.     left join LUcourt on LUcourt.id=kase.court_id  WHERE job.subscriber_id = 1 and job_id in (select distinct job.id from job where job.subscriber_id = '1' order by id+0) LIMIT 0,500
  39. </pre>
  40.    
  41. SELECT DISTINCT sql_no_cache  job.id, job.id as job_id, job.job_status, job.servee_name, kase.plaintiff, index_number, lawfirm_filenumber, DATE_FORMAT(job.datetime_received, '%m/%d/%Y') as date_received, DATE_FORMAT(job.date_sent_to_court, '%m/%d/%Y') as date_sent_to_court, DATE_FORMAT(kase.date_kase_filed, '%m/%d/%Y') as date_kase_filed, TO_DAYS(NOW())-TO_DAYS(kase.date_kase_filed) as thedays, DATE_FORMAT(kase.court_datetime, '%m/%d/%Y %h:%i %p') as court_date, kase.court_room, CONCAT(LUcourt.court_county," - ",LUcourt.court_type) as court_name, DATE_FORMAT(job.datetime_served, '%m/%d/%Y') as datetime_served, concat(server.namefirst,' ', server.namelast) as server_name FROM job
  42. LEFT JOIN kase ON job.kase_id = kase.id
  43. LEFT JOIN kasebilling  ON kasebilling.kase_id = kase.id
  44. LEFT JOIN server ON job.server_id = server.id
  45. left join client on client.id=kase.client_id
  46. left join LUcourt on LUcourt.id=kase.court_id  WHERE job.subscriber_id = 1 and job_id in (select distinct job.id from job where job.subscriber_id = '1' order by id+0) LIMIT 0,500
  47.    
  48. SELECT DISTINCT sql_no_cache  job.id, job.id as job_id, job.job_status, job.servee_name, kase.plaintiff, index_number, lawfirm_filenumber, DATE_FORMAT(job.datetime_received, '%m/%d/%Y') as date_received, DATE_FORMAT(job.date_sent_to_court, '%m/%d/%Y') as date_sent_to_court, DATE_FORMAT(kase.date_kase_filed, '%m/%d/%Y') as date_kase_filed, TO_DAYS(NOW())-TO_DAYS(kase.date_kase_filed) as thedays, DATE_FORMAT(kase.court_datetime, '%m/%d/%Y %h:%i %p') as court_date, kase.court_room, CONCAT(LUcourt.court_county," - ",LUcourt.court_type) as court_name, DATE_FORMAT(job.datetime_served, '%m/%d/%Y') as datetime_served, concat(server.namefirst,' ', server.namelast) as server_name FROM job
  49. LEFT JOIN kase ON job.kase_id = kase.id
  50. LEFT JOIN kasebilling  ON kasebilling.kase_id = kase.id
  51. LEFT JOIN server ON job.server_id = server.id
  52. left join client on client.id=kase.client_id
  53. left join LUcourt on LUcourt.id=kase.court_id  WHERE job.subscriber_id = 1 and job_id in (select distinct job.id from job where job.subscriber_id = '1' order by id+0) LIMIT 0,500
  54.    
  55. FROM      kase
  56. LEFT JOIN job     ON k.kase_id   = kase.id
  57.                  AND job.subscriber_id = '1' /* condition copied here ... */
  58. LEFT JOIN kb      ON kb.kase_id  = kase.id
  59. LEFT JOIN server  ON job.server_id = server.id
  60. LEFT JOIN client  ON client.id   = kase.client_id
  61. LEFT JOIN LUcourt ON LUcourt.id  = kase.court_id
  62.     WHERE job.subscriber_id = '1'            /* ... but also kept here */
  63.  ORDER BY job.id
  64.     LIMIT 0,500;
  65.    
  66. FROM
  67. ( SELECT * /* you probably have to list & alias column names if necessary */
  68.   FROM      kase
  69.   LEFT JOIN job   ON k.kase_id   = kase.id
  70.       WHERE job.subscriber_id = '1'
  71.    ORDER BY job.id
  72.       LIMIT 0,500
  73. ) AS kase_job
  74. /* Now we have 500 rows*/
  75.  
  76. LEFT JOIN kb      ON kb.kase_id  = kase_job.id
  77. LEFT JOIN server  ON kase_job.server_id = server.id
  78. LEFT JOIN client  ON client.id   = kase_job.client_id
  79. LEFT JOIN LUcourt ON LUcourt.id  = kase_job.court_id
  80.  
  81. /* If you do `(500 rows) LEFT JOIN whatever` you can be sure you have
  82.    at least 500 rows (never less) here, so you have to ORDER/LIMIT then again
  83. */
  84.  
  85.  ORDER BY kase_job.id
  86.     LIMIT 0,500;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top