Retrive data from Database through dataprovider

i have two tables named Order and Cart,

and having the data like this.

-------------------Order---------------

|orderid|totalQuantity|totalPrice|userid|

|—2---|----5--------|–250-----|-255–|

|—3---|----8--------|–850-----|-2545-|

note:"userid" in "Order" table have index on "User" table "id"

---------------------Cart------------------

|cartid|orderid|paymentstatus|Userid|productid|

| 25–|--2----|–Done-------|-255–|—25----|

| 25–|--2----|–Done-------|-255–|—655—|

| 25–|--2----|–Done-------|-255–|—65----|

| 25–|--3----|–Done-------|-255–|—254—|

note:"orderid" in "Cart" table have index on "Order" table "id"

 "productid" in "Cart" table have index on "Product" table "id"

i want to show the order history based on user login.

i’m tried with CArrayDataProvider with CListiview, it become challenging to get data from database.

Please Help me anyway to get the data from database.