SELECT n.id,eocv0.value vendor, ocv0.value vendor_id,ocv1.value model,ocv2.value description,ocv3.value width,ocv4.value height,ocv5.value depth,ocv6.value weight,eocv7.value battery_type, ocv7.value battery_type_id,ocv8.value capacity,ocv9.value work_time,eocv10.value platform, ocv10.value platform_id,ocv11.value os,eocv12.value processor_vendor, ocv12.value processor_vendor_id,ocv13.value processor_name,ocv14.value processor_freq,ocv15.value rom,ocv16.value ram,ocv17.value ram_for_user,eocv18.value cf, ocv18.value cf_id,eocv19.value sd_mmc, ocv19.value sd_mmc_id,eocv20.value sdio, ocv20.value sdio_id,eocv21.value ms, ocv21.value ms_id,ocv22.value display_size,ocv23.value resolution_x,ocv24.value resolution_y,eocv25.value color, ocv25.value color_id,eocv26.value usb, ocv26.value usb_id,eocv27.value com, ocv27.value com_id,eocv28.value irda, ocv28.value irda_id,eocv29.value bluetooth, ocv29.value bluetooth_id,eocv30.value wifi, ocv30.value wifi_id,eocv31.value gsm_gprs, ocv31.value gsm_gprs_id,ocv32.value joystick,ocv33.value keyboard,eocv34.value sensor_display, ocv34.value sensor_display_id,eocv35.value speaker, ocv35.value speaker_id,eocv36.value mic, ocv36.value mic_id,eocv37.value camera, ocv37.value camera_id,eocv38.value stereoout, ocv38.value stereoout_id,ocv39.value misc FROM catalog_objects co JOIN catalog_values_str cv11 ON (co.id=cv11.object_id AND cv11.field_id=15 AND cv11.value LIKE '%0%')
JOIN catalog_values_opt ocv0 ON (co.id=ocv0.object_id AND ocv0.field_id=1)
JOIN essense_options eocv0 ON eocv0.id=ocv0.value
JOIN catalog_values_str ocv1 ON (co.id=ocv1.object_id AND ocv1.field_id=2)
JOIN catalog_values_str ocv2 ON (co.id=ocv2.object_id AND ocv2.field_id=3)
JOIN catalog_values_int ocv3 ON (co.id=ocv3.object_id AND ocv3.field_id=6)
JOIN catalog_values_int ocv4 ON (co.id=ocv4.object_id AND ocv4.field_id=7)
JOIN catalog_values_int ocv5 ON (co.id=ocv5.object_id AND ocv5.field_id=8)
JOIN catalog_values_int ocv6 ON (co.id=ocv6.object_id AND ocv6.field_id=10)
JOIN catalog_values_opt ocv7 ON (co.id=ocv7.object_id AND ocv7.field_id=11)
JOIN essense_options eocv7 ON eocv7.id=ocv7.value
JOIN catalog_values_int ocv8 ON (co.id=ocv8.object_id AND ocv8.field_id=12)
JOIN catalog_values_str ocv9 ON (co.id=ocv9.object_id AND ocv9.field_id=13)
JOIN catalog_values_opt ocv10 ON (co.id=ocv10.object_id AND ocv10.field_id=14)
JOIN essense_options eocv10 ON eocv10.id=ocv10.value
JOIN catalog_values_str ocv11 ON (co.id=ocv11.object_id AND ocv11.field_id=15)
JOIN catalog_values_opt ocv12 ON (co.id=ocv12.object_id AND ocv12.field_id=16)
JOIN essense_options eocv12 ON eocv12.id=ocv12.value
JOIN catalog_values_str ocv13 ON (co.id=ocv13.object_id AND ocv13.field_id=17)
JOIN catalog_values_int ocv14 ON (co.id=ocv14.object_id AND ocv14.field_id=18)
JOIN catalog_values_int ocv15 ON (co.id=ocv15.object_id AND ocv15.field_id=19)
JOIN catalog_values_int ocv16 ON (co.id=ocv16.object_id AND ocv16.field_id=20)
JOIN catalog_values_int ocv17 ON (co.id=ocv17.object_id AND ocv17.field_id=21)
JOIN catalog_values_opt ocv18 ON (co.id=ocv18.object_id AND ocv18.field_id=22)
JOIN essense_options eocv18 ON eocv18.id=ocv18.value
JOIN catalog_values_opt ocv19 ON (co.id=ocv19.object_id AND ocv19.field_id=23)
JOIN essense_options eocv19 ON eocv19.id=ocv19.value
JOIN catalog_values_opt ocv20 ON (co.id=ocv20.object_id AND ocv20.field_id=24)
JOIN essense_options eocv20 ON eocv20.id=ocv20.value
JOIN catalog_values_opt ocv21 ON (co.id=ocv21.object_id AND ocv21.field_id=25)
JOIN essense_options eocv21 ON eocv21.id=ocv21.value
JOIN catalog_values_str ocv22 ON (co.id=ocv22.object_id AND ocv22.field_id=26)
JOIN catalog_values_int ocv23 ON (co.id=ocv23.object_id AND ocv23.field_id=27)
JOIN catalog_values_int ocv24 ON (co.id=ocv24.object_id AND ocv24.field_id=28)
JOIN catalog_values_opt ocv25 ON (co.id=ocv25.object_id AND ocv25.field_id=29)
JOIN essense_options eocv25 ON eocv25.id=ocv25.value
JOIN catalog_values_opt ocv26 ON (co.id=ocv26.object_id AND ocv26.field_id=30)
JOIN essense_options eocv26 ON eocv26.id=ocv26.value
JOIN catalog_values_opt ocv27 ON (co.id=ocv27.object_id AND ocv27.field_id=31)
JOIN essense_options eocv27 ON eocv27.id=ocv27.value
JOIN catalog_values_opt ocv28 ON (co.id=ocv28.object_id AND ocv28.field_id=32)
JOIN essense_options eocv28 ON eocv28.id=ocv28.value
JOIN catalog_values_opt ocv29 ON (co.id=ocv29.object_id AND ocv29.field_id=33)
JOIN essense_options eocv29 ON eocv29.id=ocv29.value
JOIN catalog_values_opt ocv30 ON (co.id=ocv30.object_id AND ocv30.field_id=34)
JOIN essense_options eocv30 ON eocv30.id=ocv30.value
JOIN catalog_values_opt ocv31 ON (co.id=ocv31.object_id AND ocv31.field_id=35)
JOIN essense_options eocv31 ON eocv31.id=ocv31.value
JOIN catalog_values_str ocv32 ON (co.id=ocv32.object_id AND ocv32.field_id=36)
JOIN catalog_values_str ocv33 ON (co.id=ocv33.object_id AND ocv33.field_id=37)
JOIN catalog_values_opt ocv34 ON (co.id=ocv34.object_id AND ocv34.field_id=38)
JOIN essense_options eocv34 ON eocv34.id=ocv34.value
JOIN catalog_values_opt ocv35 ON (co.id=ocv35.object_id AND ocv35.field_id=39)
JOIN essense_options eocv35 ON eocv35.id=ocv35.value
JOIN catalog_values_opt ocv36 ON (co.id=ocv36.object_id AND ocv36.field_id=40)
JOIN essense_options eocv36 ON eocv36.id=ocv36.value
JOIN catalog_values_opt ocv37 ON (co.id=ocv37.object_id AND ocv37.field_id=41)
JOIN essense_options eocv37 ON eocv37.id=ocv37.value
JOIN catalog_values_opt ocv38 ON (co.id=ocv38.object_id AND ocv38.field_id=42)
JOIN essense_options eocv38 ON eocv38.id=ocv38.value
JOIN catalog_values_str ocv39 ON (co.id=ocv39.object_id AND ocv39.field_id=43)
JOIN t_navigation n ON (n.module_id='5' AND n.inner_id=co.catalog_entry_id) ORDER BY ocv0.value,ocv1.value,ocv2.value,ocv3.value,ocv4.value,ocv5.value,ocv6.value,ocv7.value,ocv8.value,ocv9.value,ocv10.value,ocv11.value,ocv12.value,ocv13.value,ocv14.value,ocv15.value,ocv16.value,ocv17.value,ocv18.value,ocv19.value,ocv20.value,ocv21.value,ocv22.value,ocv23.value,ocv24.value,ocv25.value,ocv26.value,ocv27.value,ocv28.value,ocv29.value,ocv30.value,ocv31.value,ocv32.value,ocv33.value,ocv34.value,ocv35.value,ocv36.value,ocv37.value,ocv38.value,ocv39.value
Рулез правда не работает =).
у меня прога сгенерила запрос с 39-ю JOIN'ами, а он, видите ли, не держит больше 31-го
Marikun
31 джойн - это далеко не предел. Вот Sybase ASE не умеет больше 50 джойнов выполнять. Вот мы в свое время из-за этого потрахались...
А еще очень порадовала IBM DB2 UDB, которая как-то раз выдала сообщение Sql is too complex %)
laki
Рулез правда не работает =).