Guest User

Untitled

a guest
Jun 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.20 KB | None | 0 0
  1. SELECT distinct works.*, count(*) as view_count, views.id AS v_id, views.catalognum AS v_catalognum, views.ptif_file_directory AS v_ptif_file_directory, views.ptif_file_filename AS v_ptif_file_filename, views.thumb_file_directory AS v_thumb_file_directory, views.thumb_file_filename AS v_thumb_file_filename, views.subscription_visible AS v_subscription_visible, views.org_file_bucket AS v_org_file_bucket, views.org_file_directory AS v_org_file_directory, views.org_file_filename AS v_org_file_filename, views.med_file_bucket AS v_med_file_bucket, views.med_file_directory AS v_med_file_directory, views.med_file_filename AS v_med_file_filename, (select count(*) FROM artists_works aw WHERE aw.work_id=works.id) AS artist_count, (select count(*) FROM periods_works pw WHERE pw.work_id=works.id) AS period_count, (select group_concat(distinct(concat(if(awnx.id is null,'',awnx.id),';',if(anx.display_name is null,'',anx.display_name),';',if(anx.display_date is null,'',anx.display_date),';',if(nnx.name is null,'',nnx.name),';',if(awnx.attribution is null,'',awnx.attribution),';',IF(anx.rights IS NULL,'',anx.rights))),'') FROM artists_works awnx LEFT JOIN artists anx ON awnx.artist_id=anx.id LEFT JOIN nationalities nnx ON anx.nationality_id=nnx.id WHERE awnx.artist_id = anx.id and awnx.work_id = works.id ) AS artist_raw, (select group_concat(distinct(concat( IF(pwn.id IS NULL,'',pwn.id),';', IF(pn.name IS NULL,'', pn.name))),'') FROM periods_works pwn, periods pn where pwn.work_id = works.id AND pwn.period_id = pn.id ) AS period_raw, (select concat( IF(lx.id IS NULL,'', lx.id),';', IF(lx.building IS NULL,'',lx.building)) from locations lx INNER JOIN locations_works lwx ON lx.id = lwx.location_id WHERE lwx.work_id = works.id and lwx.location_type_id = 1 LIMIT 1) AS location_raw, (SELECT brand_name FROM vendors vx WHERE vx.id = works.vendor_id LIMIT 1) AS vn_brand_name FROM works, views WHERE views.work_id=works.id AND works.visible=1 AND views.visible=1 AND works.id IN (-2048123215,-1991619841,-1675242652,-1612037713,-1556313285,-1534267423,-1521194210,-1337066553,-1300564112,-1227747386,-1114768232,-1075175060,-1004837666,-958423624,-940448499,-891975654,-801106219,-762553854,-646973390,-532734818,-333437099,-203028943,161,164,165,166,168,170,172,173,174,175,176,177,180,182,183,184,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,216,221,222,223,224,225,228,229,230,231,232,233,236,237,238,239,240,241,242,243,245,248,249,250,251,252,254,258,260,262,263,268,269,270,274,275,289,290,310,311,313,314,315,327,329,331,332,334,341,342,343,344,346,347,348,349,350,351,352,353,370,410,415,416,427,428,442,443,444,445,446,447,452,453,454,455,457,458,459,460,461,462,463,464,465,466,467,468,472,474,475,476,477,480,481,482,483,484,485,486,488,489,490,491,492,494,495,496,497,498,499,500,501,502,505,506,508,509,510,511,512,513,514,516,518,519,520,521,526,528,529,530,531,534,540,553,559,653,654,655,658,669,670,671,701,702,703,704,705,706,707,712,713,714,715,716,717,718,723,728,729,732,733,734,735,736,747,764,765,767,768,778,781,782,784,785,786,788,791,792,799,802,803,805,806,807,808,809,810,817,828,829,833,834,837,838,840,841,843,846,850,878,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,896,897,899,909,918,920,922,924,925,926,927,928,929,930,931,932,933,934,935,952,956,961,962,964,967,968,969,970,972,973,980,981,983,988,989,991,992,994,996,998,1000,1002,1003,1004,1008,1015,1016,1017,1018,1019,1021,1022,1023,1024,1025,1026,1047,1048,1049,1102,1148,1150,1216,1217,1218,1240,1242,1243,1244,1266,1307,1308,1309,1310,1311,1356,1357,1358,1359,1360,1405,1500,1501,1508,1525,1530,1533,1537,1547,1555,1562,1575,1578,1579,1580,1581,1582,1583,1586,1587,1588,1589,1590,1591,1592,1593,1594,1635,1650,1652,1662,1663,1664,1665,1666,1667,1669,1670,1671,1672,1673,1674,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1691,1692,1693,1694,1695,1697,1699,1704,1705,1706,1707,1708,1709,1710,1718,1719,1720,1721,1722,1723,1730,1734,1770,1782,1793,1800,1828,1829,1842,1843,1849,1861,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1934,1935,1936,1938,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1974,1975,1976,1977,1979,1980,1981,1990,2016,2017,2018,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2091,2092,2093,2094,2118,2119,2129,2132,2133,2141,2150,2151,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2236,2237,2238,2240,2241,2242,2243,2245,2249,2250,2254,2255,2256,2257,2258,2259,2272,2273,2277,2278,2279,2280,2281,2282,2283,2297,2301,2302,2303,2317,2320,2322,2346,2347,2348,2351,2352,2353,2354,2355,2356,2359,2360,2361,2363,2365,2366,2367,2370,2371,2372,2379,2385,2389,2390,2391,2393,2394,2396,2397,2398,2401,2403,2404,2405,2406,2408,2410,2426,2430,2431,2437,2443,2445,2450,2459,2467,2468,2469,2470,2474,2539,2540,2541,2545,2547,2548,2549,2550,2551,2552,2564,2569,2570,2571,2572,2573,2574,2575,2583,2601,2602,2603,2604,2605,2606,2610,2615,2616,2621,2650,2655,2657,2658,2660,2666,2667,2670,2671,2673,2677,2682,2695,2697,2728,2765,2789,2790,2791,2792,2809,2822,2825,2830,2834,2835,2840,2843,2844,2848,2849,2858,2859,2863,2868,2869,2875,2882,2885,2892,2936,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961,2962,2963,2964,2965,2966,2967,2970,2973,2974,2977,2978,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2994,2995,3003,3011,3013,3016,3017,3031,3032,3034,3040,3041,3042,3052,3060,3067,3069,3077,3078,3087,3097,3099,3101,3106,3114,3120,3121,3125,3128,3129,3136,3161,3162,3163,3164,3165,3170,3175,3179,3257,3258,3259,3260,3261,3262,3263,3264,3265,3268,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3299,3321,3322,3323,3324,3325,3355,3358,3359,3360,3361,3408,3424,3446,3448,3450,3451,3452,3453,3454,3455,3456,3457,3463,3465,3466,3467,3468,3469,3481,3482,3483,3484,3485,3486,3493,3494,3526,3561,3563,3577,3589,3590,3612,3620,3633,3634,3676,3678,3679,3680,3684,3685,3686,3699,3703,3708,3724,3732,3735,3747,3789,3830,3831,3836,3872,3875,3876,3877,3878,3879,3880,3881,3883,3884,3885,3886,3890,3914,3915,3916,3917,3918,4034,4035,4051,4054,4065,4066,4072,4109,4126,4128,4242,4243,4244,4251,4255,4256,4358,4360,4363,4364,4365,4366,4367,4368,4369,4370,4371,4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4400,4401,4402,4417,4423,4424,4425,4511,4514,5028,5030,5031,5032,5033,5278,5280,5311,5409,5410,5411,5412,5413,5414,5429,5430,5431,5432,5459,5460,5461,5463,5539,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616,5619,5620,5621,5622,5623,5624,5626,5627,5630,5631,5632,5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,5650,5651,5653,5654,5728,5729,5751,5762,5764,5765,5766,6040,6041,6046,6055,6058,6059,6064,6077,6081,6086,6261,6263,6269,6271,6272,6273,6275,6281,6348,6349,6354,6356,6362,6364,6365,6367,6373,6379,6420,6434,6451,6454,6455,6458,6459,6460,6461,6462,6464,6465,6467,6468,6469,6478,6493,6495,6499,6501,6505,6508,6509,6514,6518,6519,6521,6523,6533,6534,6541,6542,6543,6546,6547,6548,6549,6550,6552,6555,6565,6566,6567,6568,6574,6575,6580,6590,6597,6651,6652,6724,6725,6726,6727,6728,6729,6730,6731,6732,6733,6734,6735,6736,6737,6738,6741,6742,6743,6744,6745,6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6908,6912,6913,6939,6941,6942,6943,6944,6945,6946,6947,6948,6949,7101,7102,7103,7353,7355,7411,7546,7547,7548,7549,7550,7551,7552,7553,7554,7555,7556,7557,7559,7560,7561,7562,7566,7567,7568,7569,7570,7571,7608,7611,7619,7622,7623,7632,7633,7634,7635,7638,7639,7640,7644,7659,7660,7661,7662,7663,7664,7665,7666,7667,7669,7670,7671,7680,7693,7694,7695,7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7707,7709,7710,7711,7712,7713,7714,7715,7716,7717,7718,7719,7727,7728,7755,7756,7757,7759,7760,7761,7762,7763,7764,7765,7767,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778,7782,7783,7801,7802,7803,7804,7805,7807,7809,7810,7811,7812,7813,7814,7815,7816,7818,7819,7820,7821,7822,7824,7825,7829,7830,7831,7832,7871,7931,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7953,8222,8223,8263,8308,8309,8310,8321,8322,8323,8325,8349,8352,8357,8358,8375,8376,8377,8378,8379,8381,8382,8383,8384,8385,8386,8387,8388,8389,8418,8419,8421,8428,8429,8430,8431,8435,8436,8457,8459,8464,8466,8473,8488,8489,8504,8506,8658,8708,149588898,200603589,249197929,335304081,569486915,598246221,767307425,767397156,863445647,893346324,896910689,896992072,897325459,897344705,897409222,897504923,897505137,897508162,924733088,941130130,982199523,1362970610,1402077333,1468134078,1554648060,1672849870,1680575691,1774424723,1825941241,1845182107,1866610053,1875898464,2034216224,2080858482,2144551321,2144551322,2144551323,2144551324,2144551325,2144551326,2144551327,2144551330,2144551352,2144551353,2144551731,2144551734,2144551736,2144551737,2144551738,2144551739,2144551740,2144551741,2144551743,2144551744,2144551745,2144551746,2144551747,2144552055,2144552056,2144552057,2144552058,2144552061,2144552063,2144552064,2144552065,2144552251,2144552253,2144552310,2144552362,2144558855,2144558856,2144558857,2144558859,2144558860,2144558861,2144558862,2144558863,2144558864,2144558865,2144558871,2144577209,2144592669,2144592671,2144592674,2144592683,2144592684,2144592690,2144592691,2563,2144594716,2144594749,2144595023,2144595024,2144595025,2144595026,2144595037,2144595749,2144595750,2144595753,2144595754,2144595756,2144594588,2144594707,2144594897,2144594889,2144594609,2144594610,2144594726,2144594727,2144594748,2144594785,2144593423,2144594589,2144594604,2144594605,2144595125,2144594549,2144595253,2144594931,2144594566,2144594567,2144594568,2144594564,2144594565,2144594652,2144595033,2144594717,2144594718,2144599748,2144594548,2144594585,2144594546,2144594579,2144593184,2144594576,2144594577,2144594578,2144594599,2144592840,2144592841,2144592853,2144592854,2144592856,2144592857,2144592862,2144593070,2144594584,2144594866,2144601042,2144594934,2144594547,2144594883,2144595097,2144594933,2144595629,2144595003,2144594562,2144595002,2144594471,2144595000,2144595001,2144594641,2144593189,2144594405,2144594556,2144594715,2144594842,2144594843,2144594846,2144594852,2144594855,2144594853,2144595720,2144595722,2144595721,2144594873,2144594575,2144594867,2144595035,2144594860,2144594596,2144594706,2144595079,2144594708,2144594636,2144594755,2144595022,2144595019,2144594266,2144594722,2144595038,2144595039,2144594872,2144595627,2144595758,2144594864,2144595013,2144594551,2144594552,2144594553,2144595017,2144595034,2144595014,2144594874,2144595015,2144594966,2144593670,2144595016,2144594561,2144594659,2144595095,2144601043,2144595018,2144594704,2144595628,2144595006,2144594930,2144594875,2144594885,2144595136,2144594591,2144594869,2144594870,2144594729,2144594859,2144595093,2144595092,2144594725,2144595004,2144594253,2144595090,2144594754,2144595089,2144595084,2144595085,2144595083,2144595711,2144603835,2144594607,2144594598,2144594861,2144594709,2144596527,2144594617,2144595078,2144595080,2144595082,2144594443,2144594470,2144594862,2144594554,2144595222,2144594714,2144595221,2144594621,2144595007,2144595226,2144595774,2144601039,2144601040,2144601041,2144595224,2144592995,2144593003,2144594701,2144594702,2144594703,2144594720,2144594723,2144595667,2144595668,2144594559,2144594876,2144594710,2144595223,2144595008,2144595225,2144595238,2144593470,2144594711,2144594700,2144595107,2144594705,2144594743,2144594868,2144594879,2144594557,2144595104,2144594932,2144594555,2144594871,2144592861,2144594721,2144594352,2144594712,2144594713,2144595712,2144596595,2144593464,2144593465,2144594442,2144595100,2144595099,2144595101,2144595102,2144595096,2144592868,2144594558,2144595098,2144594880,2144595242,2144595244,2144595106,2144595036,2144594858,2144593095,2144594563,2144594730,2144595005,2144595122,2144595632,2144594719,2144594783,2144594784,2144594622,2144594746,2144595088,2144594602,2144594623,2144594624,2144594625,2144595239,2144594626,2144594786,2144595241,2144595709,2144594752,2144594892,2144594893,2144595135,2144595757,2144594615,2144594847,2144595326,2144595327,2144595331,2144595377,2144604059,2144608233,2144608234,2144608236,2144608237,2144608240,2144608291,2144608293,2144608294,2144608531,2144609996,2144610114)AND works.id in (select work_id from artists_works where artist_id in (993)) AND (works.site) LIKE '%%' OR (works.site) LIKE '%%' GROUP BY works.id ORDER BY works.title, works.work_date
Add Comment
Please, Sign In to add comment