Welcome Guest, Not a member yet? Register   Sign In
junction table join?
#5

(08-09-2022, 08:36 AM)SubrataJ Wrote:
(08-09-2022, 06:48 AM)bikebetty Wrote:
(08-08-2022, 10:32 PM)SubrataJ Wrote:
(08-08-2022, 08:19 PM)bikebetty Wrote: I have a junction table. I want to make a datatable. I did this with other tables and I created a join but can I do this with a large junction table?

Obviously, you can do that with the correct query.

Can you show me how or lead me to a place where I can learn?

I don't know about your table structure, if we could provide it, I will be more than happy to assist.


PHP Code:
id agricultural_operation_address_id property_owner_address_id agricultural_operation_owner_address_id operator_address_id wqpp_id creation_date started_date finished_date last_edit_date current_step current_address_index current_operation_details_index current_parcel_index current_wqpp_index current_map_index user_id is_active started finished prepaired_by groundwater_wells_used_for_drinking_water groundwater_monitoring_by has_waterbodies_located_within_100_feet waterbodies_located_within_100_feet has_waterbody_pass_through_or_exist_on waterbody_pass_through_or_exist_on has_irrigation_return_flow_or_storm_water_discharged user_agent pdf_emailed_date active
3 12 13 14 15 3 1500952539 1500952543 1501693782 1501693782 6 4 2 1 3 1 1 1 0 Michael 0 0 0 0 Mozilla
/5.0 (MacintoshIntel Mac OS X 10_10_1AppleWebKit/537.36 (KHTMLlike GeckoChrome/59.0.3071.115 Safari/537.36 1501693809 0
17000 17 18 19 20 4 1500991346 1500991353 1503082969 4 4 2 1 1 1 7543 1 0 0 1 lake 0 0 Mozilla
/5.0 (Windows NT 10.0Win64x64AppleWebKit/537.36 (KHTMLlike GeckoChrome/52.0.2743.116 Safari/537.36 Edge/15.15063 1
17001 21 22 23 24 5 1500998879 1500998895 1569350595 1569350595 6 4 2 8 3 2 7245 1 1 Janet 0 0 0 0 Mozilla
/5.0 (Windows NT 10.0Win64x64AppleWebKit/537.36 (KHTMLlike GeckoChrome/70.0.3538.102 Safari/537.36 Edge/18.18362 1569350648 1 
This is so long I'm not sure how to get it all but here are a couple lines from the main table. This goes to maybe 10 other tables that are also junction tables. I think I just need to know the process to get them out and show in the table...
Code:
public function get_all_invoices(){
$this->db->select('
ci_payments.id,
ci_payments.invoice_no,
CONCAT(ci_users.member_first_name, " ", ci_users.member_last_name) as client_name,
ci_users.member_first_name,
ci_users.member_last_name,
ci_payments.payment_status,
ci_payments.grand_total,
ci_payments.currency,
ci_payments.due_date,
'
    );
    $this->db->from('ci_payments');
    $this->db->join('ci_users', 'ci_users.id = ci_payments.user_id ', 'left');
    $query = $this->db->get();
return $query->result_array();
}

I did the other one like this. I don't know if that's right but it seems to be working. This other one is just so much information.
Reply


Messages In This Thread
junction table join? - by bikebetty - 08-08-2022, 08:19 PM
RE: junction table join? - by SubrataJ - 08-08-2022, 10:32 PM
RE: junction table join? - by bikebetty - 08-09-2022, 06:48 AM
RE: junction table join? - by SubrataJ - 08-09-2022, 08:36 AM
RE: junction table join? - by bikebetty - 08-09-2022, 03:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB