Skip to content

Instantly share code, notes, and snippets.

@mbajur
Created September 10, 2014 16:32
Show Gist options
  • Save mbajur/2ccf856b2a1ff2be2348 to your computer and use it in GitHub Desktop.
Save mbajur/2ccf856b2a1ff2be2348 to your computer and use it in GitHub Desktop.
SELECT "jobs"."id" AS t0_r0,
"jobs"."ro_number" AS t0_r1,
"jobs"."ro_value" AS t0_r2,
"jobs"."upsell_value" AS t0_r3,
"jobs"."technician_id" AS t0_r4,
"jobs"."customer_id" AS t0_r5,
"jobs"."end_behaviour" AS t0_r6,
"jobs"."status" AS t0_r7,
"jobs"."created_at" AS t0_r8,
"jobs"."updated_at" AS t0_r9,
"jobs"."dealership_id" AS t0_r10,
"jobs"."author_id" AS t0_r11,
"jobs"."closed_at" AS t0_r12,
"jobs"."videos_count" AS t0_r13,
"jobs"."watches_count" AS t0_r14,
"jobs"."final_ro_value" AS t0_r15,
"jobs"."guid" AS t0_r16,
"jobs"."callback_requested_at" AS t0_r17,
"jobs"."send_reminder_at" AS t0_r18,
"jobs"."reminder_sent_at" AS t0_r19,
"jobs"."upsell_percentage" AS t0_r20,
"users"."id" AS t1_r0,
"users"."email" AS t1_r1,
"users"."encrypted_password" AS t1_r2,
"users"."reset_password_token" AS t1_r3,
"users"."reset_password_sent_at" AS t1_r4,
"users"."remember_created_at" AS t1_r5,
"users"."sign_in_count" AS t1_r6,
"users"."current_sign_in_at" AS t1_r7,
"users"."last_sign_in_at" AS t1_r8,
"users"."current_sign_in_ip" AS t1_r9,
"users"."last_sign_in_ip" AS t1_r10,
"users"."confirmation_token" AS t1_r11,
"users"."confirmed_at" AS t1_r12,
"users"."confirmation_sent_at" AS t1_r13,
"users"."unconfirmed_email" AS t1_r14,
"users"."failed_attempts" AS t1_r15,
"users"."unlock_token" AS t1_r16,
"users"."locked_at" AS t1_r17,
"users"."authentication_token" AS t1_r18,
"users"."name" AS t1_r19,
"users"."phone" AS t1_r20,
"users"."role" AS t1_r21,
"users"."dealership_id" AS t1_r22,
"users"."jobs_count" AS t1_r23,
"users"."videos_count" AS t1_r24,
"users"."is_admin" AS t1_r25,
"users"."created_at" AS t1_r26,
"users"."updated_at" AS t1_r27,
"technicians_jobs"."id" AS t2_r0,
"technicians_jobs"."email" AS t2_r1,
"technicians_jobs"."encrypted_password" AS t2_r2,
"technicians_jobs"."reset_password_token" AS t2_r3,
"technicians_jobs"."reset_password_sent_at" AS t2_r4,
"technicians_jobs"."remember_created_at" AS t2_r5,
"technicians_jobs"."sign_in_count" AS t2_r6,
"technicians_jobs"."current_sign_in_at" AS t2_r7,
"technicians_jobs"."last_sign_in_at" AS t2_r8,
"technicians_jobs"."current_sign_in_ip" AS t2_r9,
"technicians_jobs"."last_sign_in_ip" AS t2_r10,
"technicians_jobs"."confirmation_token" AS t2_r11,
"technicians_jobs"."confirmed_at" AS t2_r12,
"technicians_jobs"."confirmation_sent_at" AS t2_r13,
"technicians_jobs"."unconfirmed_email" AS t2_r14,
"technicians_jobs"."failed_attempts" AS t2_r15,
"technicians_jobs"."unlock_token" AS t2_r16,
"technicians_jobs"."locked_at" AS t2_r17,
"technicians_jobs"."authentication_token" AS t2_r18,
"technicians_jobs"."name" AS t2_r19,
"technicians_jobs"."phone" AS t2_r20,
"technicians_jobs"."role" AS t2_r21,
"technicians_jobs"."dealership_id" AS t2_r22,
"technicians_jobs"."jobs_count" AS t2_r23,
"technicians_jobs"."videos_count" AS t2_r24,
"technicians_jobs"."is_admin" AS t2_r25,
"technicians_jobs"."created_at" AS t2_r26,
"technicians_jobs"."updated_at" AS t2_r27,
"authors_jobs"."id" AS t3_r0,
"authors_jobs"."email" AS t3_r1,
"authors_jobs"."encrypted_password" AS t3_r2,
"authors_jobs"."reset_password_token" AS t3_r3,
"authors_jobs"."reset_password_sent_at" AS t3_r4,
"authors_jobs"."remember_created_at" AS t3_r5,
"authors_jobs"."sign_in_count" AS t3_r6,
"authors_jobs"."current_sign_in_at" AS t3_r7,
"authors_jobs"."last_sign_in_at" AS t3_r8,
"authors_jobs"."current_sign_in_ip" AS t3_r9,
"authors_jobs"."last_sign_in_ip" AS t3_r10,
"authors_jobs"."confirmation_token" AS t3_r11,
"authors_jobs"."confirmed_at" AS t3_r12,
"authors_jobs"."confirmation_sent_at" AS t3_r13,
"authors_jobs"."unconfirmed_email" AS t3_r14,
"authors_jobs"."failed_attempts" AS t3_r15,
"authors_jobs"."unlock_token" AS t3_r16,
"authors_jobs"."locked_at" AS t3_r17,
"authors_jobs"."authentication_token" AS t3_r18,
"authors_jobs"."name" AS t3_r19,
"authors_jobs"."phone" AS t3_r20,
"authors_jobs"."role" AS t3_r21,
"authors_jobs"."dealership_id" AS t3_r22,
"authors_jobs"."jobs_count" AS t3_r23,
"authors_jobs"."videos_count" AS t3_r24,
"authors_jobs"."is_admin" AS t3_r25,
"authors_jobs"."created_at" AS t3_r26,
"authors_jobs"."updated_at" AS t3_r27
FROM "jobs"
LEFT OUTER JOIN "users" ON "users"."id" = "jobs"."customer_id"
LEFT OUTER JOIN "users" "technicians_jobs" ON "technicians_jobs"."id" = "jobs"."technician_id"
LEFT OUTER JOIN "users" "authors_jobs" ON "authors_jobs"."id" = "jobs"."author_id"
WHERE (("jobs"."status" ILIKE '%email@email.com%'
OR "jobs"."ro_number" ILIKE '%email@email.com%'
OR "jobs"."end_behaviour" ILIKE '%email@email.com%'
OR "users"."name" ILIKE '%email@email.com%'
OR "users"."email" ILIKE '%email@email.com%'
OR "users"."phone" ILIKE '%email@email.com%'
OR "users"."name" ILIKE '%email@email.com%'
OR "users"."email" ILIKE '%email@email.com%'
OR "users"."phone" ILIKE '%email@email.com%'
OR "users"."name" ILIKE '%email@email.com%'
OR "users"."email" ILIKE '%email@email.com%'
OR "users"."phone" ILIKE '%email@email.com%'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment