473,800 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What Is Wrong With This query?

Update garment_details
SET garment_details .blankprice = '1.50'
Where garment_details .GarmentDetailI D
in (Select
garment_details .GarmentDetailI D
From garment_details
Inner Join colors ON garment_details .ColorID =
colors.ColorID
Where
colors.ColorTyp e = '1' AND
garment_details .GarmentID = 'fol3930r'
)

Mar 9 '06 #1
1 1242
"kevinjbowm an" <ke**********@g mail.com> wrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
Update garment_details
SET garment_details .blankprice = '1.50'
Where garment_details .GarmentDetailI D
in (Select
garment_details .GarmentDetailI D
From garment_details
Inner Join colors ON garment_details .ColorID =
colors.ColorID
Where
colors.ColorTyp e = '1' AND
garment_details .GarmentID = 'fol3930r'
)


It would be helpful when posting question if you would include details about
your environment and the symptoms of any error.
For instance, is this query causing an error? What is the error?
Or does it function correctly, but too slowly?
Or do you just want to know if it's good SQL coding style?

My guess is that you're using MySQL 4.0 or earlier, which doesn't support
subqueries. If so, you're getting a syntax error near where the "(Select"
subquery begins.

If you're using at least 4.0.4, you can try this instead:

UPDATE garment_details g INNER JOIN colors c ON g.ColorID = c.ColorID
SET g.blankprice = '1.50'
WHERE g.GarmentDetail ID = 'fol3930r' AND c.ColorType = '1';

This uses multi-table update syntax, which is an extension to SQL that MySQL
offers. It isn't standard SQL, but it's very useful.

Regards,
Bill K.
Mar 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1587
by: Steve | last post by:
Hi, Is there something fundamentally wrong with the following query? SELECT MAX(OrderID) AS Expr1 FROM Orders WHERE (MarketActionCode = 'S') AND (OrderLegCode = 'S') AND (Status = 'F') AND (AttemptID IN (SELECT AttemptID FROM ATTEMPT WHERE EventID = ?)) I pass in the EventID (in this case 1). the query returns the correct OrderID when I test it in sql2000 but for some reason fails to return a value when I use Java code. There is...
5
2709
by: Krisnamourt Correia via SQLMonster.com | last post by:
I have one query that executes many times in a week. I created one Maintenances plan that Rebuild all index in my Database that has been executed at 23:40 Saturday until stop finished at Sunday. However at middle of week (Wednesday or Thursday), that query don’t return result like that must be. The time exceeded and the result are total wrong. I compare the normal executed plan and the “crazy” one that SQL create to mount result.
17
2649
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in directly. so I need a way doing this. so I check to see if the ifp value is null and if so then assign it a value. is this correct?
3
3852
by: Lauren Wilson | last post by:
The following query runs just fine in the Access 2003 interface. strSQL = "SELECT tblCASES.CID, tblCASES. AS , tblCONTACTS.FirstName, tblCONTACTS.MiddleInitial, " & _ "tblCONTACTS.LastName, tblCASES., tblCONTACTS.Company, tblCONTACTS.Address1, tblCONTACTS.Address2, " & _ "tblCONTACTS.City, tblCONTACTS.State, tblCONTACTS.Zip5, tblCONTACTS.Telephone, tblCONTACTS.Facsimile, " & _ "tblCASES., tblCASES., tblCASES.AttorneyFName,...
1
3594
by: iam247 | last post by:
Hi I have a web page which receives information from a form (using request.form) and also attempts to look at an Access query to read in recoeds to a variable named rsGroup. When I have the following line commented, so it does not activate, I can successfully print all of the response.write's below: rsGroup.Open strSQL, adoCon
2
2579
by: Tarik Monem | last post by:
OK! I've gone through a few tutorials and I cannot understand what I'm doing wrong casting_registration.php <table> <tr> <td> <form enctype="multipart/form-data" action="thankyou.php" method="post" name="registrationform"> Choose a shows:
8
1522
by: Shelly | last post by:
I get an error that the input string is not in the right format. Here is the result: Here is the partial code: Dim sqlConn As New SqlConnection(SqlDataSource1.ConnectionString) Dim query As String = "SELECT * FROM Agent WHERE accountNumber=" query += "@accountNumber AND agentID=@agentID AND authCode=@authCode" Dim sqlComm As New SqlCommand(query, sqlConn) sqlComm.Parameters.Add("@accountNumber", SqlDbType.Int).Value =...
4
6201
by: =?Utf-8?B?VG9kZCBKYXNwZXJz?= | last post by:
Here is what I have: private int NationalCount() { Int32 numRecords = 0; using (SqlConnection dataConnection = new SqlConnection(GlobalVars.sqlConnString)) { SqlCommand dataCommand = new SqlCommand(); dataCommand.CommandText = ("SELECT Count(T1.ReportDate) FROM
3
2223
by: canabatz | last post by:
im using paging on this query: i got this code that returning wrong results: (SELECT bid_price, count(*) as n from bidding_details where bid_id=$bid_id GROUP BY bid_price DESC HAVING n = 1 ) UNION ALL (SELECT bid_price, count(*) as d from bidding_details where bid_id=$bid_id GROUP BY bid_price DESC HAVING d > 1) limit $eu, $limit "; the limit is working only on the first query ,the second query is running after the first limit ,so...
24
3106
by: MU | last post by:
Hello I have some code that sets a dropdownlist control with a parameter from the querystring. However, when the querystring is empty, I get an error. Here is my code: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10273
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.