Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5586 Lượt xem

I have 10 customers in my database. First i import a csv file which contains only name & email id. Later i prepare another file which contains name(for the reference), address, phone no, job etc. While  i import the second time, it created as a new record. That is an issue, it duplicate the customer record.

So how can we import datas into the existing records?

Thanks.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Export the customers to a csv file with the columns/fields you need. Make your changes and import the file again. A test data base would be good to check if it works.

The first column contains the ids of the customers. You mustn't change the ids. And don't add new rows to the file. Then the existing customers should be updated only when you import the file again.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

I see 2 solutions : 

- You create a unique constraint in your postgre database to make the name unique

- You take the id generated while exporting and you put it in id column while import.

Regards,

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 19
9186
1
thg 8 15
3155
1
thg 8 15
4314
1
thg 3 15
5539
1
thg 4 20
2860