0

I have two tables. I have about 6500 rows in one table and about 450 rows in other table. The data in the two tables are the same.

enter image description here

enter image description here

What I really want to do is to collect the data in the column "adet" in my table of 450 rows(the table name is "depoyaeklenecek") and the "adet" column in the 6500-row table(the table name is depoadetleri"). Thus, I would like to refresh my table in a way that I can write the number that I have collected in the "adet" column in the 6500-row table.

However, there is a problem, I think I have to match the ids in the "kapino" column to be able to add them. Because the data in both tables are not sorted in the same way, the capino data are in mixed order. I want it to collect the data in the "adet" column in two tables when the "kapino" ids in both tables are equal.

They are not tables with the same rows anyway. One is about 450 lines and the other is 6500 lines. Since the data in one of them will not be in the other, I need to check if the data in the kapino column is equal, then I need to collect it, I think I'm not sure.

Can I ask for help for this? Thanks

2
  • 1
    Create a dbfiddle.uk with say 10 rows from the larger table an 3 rows from the smaller one and update your question with the url to the fiddle Jan 26, 2021 at 20:01
  • There is by the way no order in a table so it is not clear what you mean when you say that the tables are not sorted the same way. Jan 26, 2021 at 22:30

1 Answer 1

0

As Lennart suggested, you should start with working example, which would help us better understood what the problem is, and what you need to be done. And please use english names in columns and table names.

(I wanted to response in comment, but apparently I have too less reputation to do that).

Basing on you description, though, it seems like simple join between these two tables, like:

select * 
from depoyaeklenecek d1 
inner join depoadetleri d2 on d2.kapino = d1.kapino

Going further, you should specify what to you understand by

  • collecting the data in the column "adet" - do you want to aggregate (sum?) them somehow? Or just fetch them to be used later?
  • refreshing my table in a way that I can write the number - do you mean that you want to update values in one table by values from the other one (per proper kapino number?) Or just want to sum these values and put them (where?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.