Python Forum
[PyQt] How to display multiple data(from 2 different related table) in one cell of QTableWid
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] How to display multiple data(from 2 different related table) in one cell of QTableWid
#1
There are 2 related tables in db.

One order_ID(table1) is mapped with multiple values prod, quantity and rate. One to Many relationship. I want to display all these values in one common table.

table 1:
order_ID date buyer ship_chr total_price
001 01/01 abc 15 240
002 05/01 xyz 10 235

table 2:
order_ID product quantity rate
001 pen 50 2
001 paper 25 1
001 pin 50 2
002 paper 25 1
002 pen 100 2

I want to display all values in one row, so all multiple values should be displayed in one cell only. So, how to display multiple values of prod, quantity and rate corresponding to one orderID?

OrderID Date Buyer Prod Quantity Rate Shipping Total
001 01/01 abc pen 50 2 15 240
paper 25 1
pin 50 2
002 05/01 xyz paper 25 1 10 235
pen 100 2
Reply
#2
Output:
table 1: order_ID date buyer ship_chr total_price 001 01/01 abc 15 240 002 05/01 xyz 10 235 table 2: order_ID product quantity rate 001 pen 50 2 001 paper 25 1 001 pin 50 2 002 paper 25 1 002 pen 100 2 I want to display in QTableWidget like this: OrderID Date Buyer Prod Quantity Rate Shipping Total 001 01/01 abc pen 50 2 15 240 paper 25 1 pin 50 2 002 05/01 xyz paper 25 1 10 235 pen 100 2
Reply
#3
Is there a python question here? Looks like pure SQL. (look into views by the way)
Reply
#4
@Larz60+
This question is related to pyqt5. I want to display table 3 in QTableWidget component of PqQT5.
Main issue is how to display multiple values in one cell of QTableWidget
Reply
#5
I see it in the header now. Sometimes I glance over the header, which is what I did here.
I'm not a big user of Qt (although I will be soon out of necessity), so will leave this for other moderators.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] How do I display the DB table I will choose from the QComboBox in QTableWidget JokerSob 2 2,273 Aug-05-2021, 03:00 PM
Last Post: JokerSob
  [Tkinter] modify the html table to include data from tkinter labels rwahdan 0 1,590 Jun-20-2021, 10:33 AM
Last Post: rwahdan
  Display MySQL data in QLlineEdit text boxes JayCee 1 4,057 Mar-26-2020, 03:55 PM
Last Post: JayCee
  [PyQt] display the contents of the table in descending order of the date atlass218 14 6,890 Nov-18-2019, 03:20 PM
Last Post: Denni
  Display and update the label text which display the serial value jenkins43 5 8,995 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 3,836 Jan-05-2019, 01:48 PM
Last Post: wuf
  [Tkinter] insert table columns data in different textboxes dimvord 4 4,857 Jun-15-2018, 07:40 AM
Last Post: dimvord
  display reading sensor data hassan_elahi 5 4,843 May-05-2018, 04:28 PM
Last Post: hassan_elahi
  Help - GTK3 + Pango: Printing data as table format scandido 0 3,170 Jan-26-2018, 06:03 PM
Last Post: scandido

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020