0
Hi,

How can i make query for this:

Table1
Column1 Column2
LS11111 0
LS22222 100
LS33333 10
LS44444 0
LS55555 25

Table2
Column1 Column3
LS11111 100
LS22222 80
LS33333 25

Result i need is
Column1 Column2
LS11111 100
LS22222 100
LS33333 25
LS44444 0
LS55555 25

Column1 is same on both tables,
Column2 is pieces number in table1, and column3 is pieces number in Table2

I need maximum piece numbers.

If table2 doesnt exist column1 value then shows table1 column2, and if it exist and is larger than table1 column2 then shows number from table2

Edited by k_7

3
Contributors
3
Replies
37
Views
3 Months
Discussion Span
Last Post by pty
2

The fact this post hasn't just been deleted is a bad sign. Burn it with fire.

Votes + Comments
Kind of leaves a bad taste in your eyes, doesn't it?
0

He's clearly not tried anything Shark_1, it's just a homework question he's pasted.

Giving him the answer will encourage this kind of behaviour in the future and further pollute our industry with qualified idiots. Not giving him the answer pollutes the forum with shitposts.

The only sensible thing to do is just delete these posts, but for some reason that doesn't happen. That's why StackOverflow has taken over.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.