है मेरे पास एक MySQL क्वेरी है जो एक परिणाम सेट में एकाधिक प्रश्नों में शामिल होने के लिए संघ का उपयोग करती है। क्वेरी पूरी तरह से काम करता है।mysql - दृश्य नहीं बना सकता है जिसमें संघ
जब मैं एक ही क्वेरी का उपयोग करने के लिए एक दृश्य बनाना चाहते हैं मैं तो एक त्रुटि संदेश मिलता है:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union select hulaminloadnumber2,deliveryid,drop1customer from localjhb where hul' at line 2
मेरी क्वेरी कि पूरी तरह से काम करता है:
select hulaminloadnumber1,deliveryid,drop1customer from localjhb where hulaminloadnumber1>0
union
select hulaminloadnumber2,deliveryid,drop1customer from localjhb where hulaminloadnumber2>0
union
select hulaminloadnumber3,deliveryid,drop1customer from localjhb where hulaminloadnumber3>0
union
select hulaminloadnumber4,deliveryid,drop1customer from localjhb where hulaminloadnumber4>0
union
select hulaminloadnumber5,deliveryid,drop1customer from localjhb where hulaminloadnumber5>0
मेरी दृश्य बनाने के लिए क्वेरी है:
create view View_LoadvsCustomer as (
select hulaminloadnumber1,deliveryid,drop1customer from localjhb where hulaminloadnumber1>0
union
select hulaminloadnumber2,deliveryid,drop1customer from localjhb where hulaminloadnumber2>0
union
select hulaminloadnumber3,deliveryid,drop1customer from localjhb where hulaminloadnumber3>0
union
select hulaminloadnumber4,deliveryid,drop1customer from localjhb where hulaminloadnumber4>0
union
select hulaminloadnumber5,deliveryid,drop1customer from localjhb where hulaminloadnumber5>0)
इस phpMyAdmin में नीचे त्रुटि पैदा करता है:
प्रश्नों एक बुरी तरह से तैयार किया गया है मेज से सभी कर रहे हैं इसलिए कोई स्वरूपण या मिलान मुद्दों होना चाहिए। क्या यूनियन क्वेरी के खिलाफ एक दृश्य बनाया जा सकता है?
किसी भी सलाह की सराहना की जाती है।
एक महान सप्ताह के अंत में है, रयान
सभी चयन प्रश्नों में एक ही स्थिति है - 'hulaminloadnumber1> 0'। क्या यह सही है? – Devart
हाय @ डेवार्ट, आप सही हैं, क्षमा करें प्रतियां खराब कोड। सवाल सही करेगा। हालांकि एक ही त्रुटि सही कोड के साथ होती है। धन्यवाद – Smudger
त्रुटि के बारे में - अश्विन के उत्तर पर एक नज़र डालें। यह ठीक करेगा। – Devart