0

Hi,
In a representative table, I have fields, like, id, mark_id, rep_id rep_name, father name,etc,
In this table, rep_id field is empty,
And in rep_area table, the fields are like id, rep_id, dist_id,etc, in this table, rep_id has values.
While editing the representative form i want to display rep_id from the rep_area table. Hopw to do?
I need the query.

4
Contributors
4
Replies
43
Views
2 Years
Discussion Span
Last Post by e.geofrey
0
SELECT rep_id, some_other_unique_descriptive_field FROM rep_area ORDER BY some_field

I'm assuming you want to build a select (dropdown) form field for this.

0

If you wish to match both table, make sure there are some unique keys for the tables to match to each other.
select representative.id, representative.mark_id, representative.rep_name, representative.father_name, representative.etc, rep_area.id, rep_area.rep_id, rep_area.dist_id, rep_area.etc from representative,rep_area where rep_area.id = representative.id;
This query is generated based on assumption that both table's id is the same.

0

I am new to MYSQL and i love it. creating tables and querries are still problem.please help me.Am from Uganda

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.