MySQL Update Inner Join Aliases?

You should use Min instead of Least: Update anothertable Join ( Select hotelid, country, to , Min(from_price) AS cheapestPrice From ( Select hotelid, country, from_price, to From table1 v Where hotelid >= 1 Union Select hotelid, country, from_price, to From table2 c Where hotelid >= 1 Union Select hotelid, country, from_price, to From table3 k Where hotelid >= 1 ) AS temp Group By temp. Hotelid, temp. Country, temp.To ) As I On anothertable.

Id = i. Hotelid And anothertable. Country = i.

Country Set price = i. CheapestPrice , op = i.To Edit As pointed out in comments, I omitted the to column from the inner temp query. However, it occurs to me that it isn't clear how to should be included because you are using an awful feature of MySQL with respect to declaring the Group By columns.

I'm assuming that you need to include to in the Group By however if that is not the case, you should be explicit about what aggregate function it should use on the to column Here's an alternate where I use Min on the to column: Update anothertable Join ( Select temp. Hotelid, temp. Country , Min(temp.

To) As to , Min(temp. From_price) AS cheapestPrice From ( Select v. Hotelid, v.

Country, v. From_price, v. To From table1 v Where hotelid >= 1 Union Select c.

Hotelid, c. Country, c. From_price, c.

To From table2 c Where hotelid >= 1 Union Select k. Hotelid, k. Country, k.

From_price, k.To From table3 k Where hotelid >= 1 ) AS temp Group By temp. Hotelid, temp. Country ) As I On anothertable.Id = i.

Hotelid And anothertable. Country = i. Country Set price = i.

CheapestPrice , op = i.to.

You should use Min instead of Least: Update anothertable Join ( Select hotelid, country, to , Min(from_price) AS cheapestPrice From ( Select hotelid, country, from_price, to From table1 v Where hotelid >= 1 Union Select hotelid, country, from_price, to From table2 c Where hotelid >= 1 Union Select hotelid, country, from_price, to From table3 k Where hotelid >= 1 ) AS temp Group By temp. Hotelid, temp. Country, temp.To ) As I On anothertable.

Id = i. Hotelid And anothertable. Country = i.

Country Set price = i. CheapestPrice , op = i.To Edit As pointed out in comments, I omitted the to column from the inner temp query. However, it occurs to me that it isn't clear how to should be included because you are using an awful feature of MySQL with respect to declaring the Group By columns.

I'm assuming that you need to include to in the Group By however if that is not the case, you should be explicit about what aggregate function it should use on the to column. Here's an alternate where I use Min on the to column: Update anothertable Join ( Select temp. Hotelid, temp.

Country , Min(temp.To) As to , Min(temp. From_price) AS cheapestPrice From ( Select v. Hotelid, v.

Country, v. From_price, v. To From table1 v Where hotelid >= 1 Union Select c.

Hotelid, c. Country, c. From_price, c.To From table2 c Where hotelid >= 1 Union Select k.

Hotelid, k. Country, k. From_price, k.

To From table3 k Where hotelid >= 1 ) AS temp Group By temp. Hotelid, temp. Country ) As I On anothertable.

Id = i. Hotelid And anothertable. Country = i.

Country Set price = i. CheapestPrice , op = i.to.

I. To is missing in quert – Richard aka cyberkiwi Feb 24 at 18:12 @Richard aka cyberkiwi - You mean other than the last line? – Thomas Feb 24 at 18:24 I mean your query will fail because of it.It refers to nothing – Richard aka cyberkiwi Feb 24 at 18:25 @Richard aka cyberkiwi - OIC.

Yeah, the OP is using that thrice damned feature in MySQL which lets you put something in the Select clause of a Group By query without requiring it be in the Group By or wrapped in an aggregate function. – Thomas Feb 24 at 18:36.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions