There are two tables in the same database tab1 and tab2 . C tab1 data is displayed in the listView , so let's say the headers, how to do that by clicking on the header in the listView , from tab2, data are displayed comparing the num column?

Example: id = 2 to output from the num column all drains of value 2, id = 3 to output from the num column all drains of value 3

 listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //как реализовать? } }); 

The table looks like this

 tab1 ------------- id|name |some| ------------- 1 |one |text| 2 |two |text| 3 |three|text| 4 |four |text| tab2 ------------------------- id|name |value |num | ------------------------- 1 |one |some |2 | 2 |two |text |2 | 3 |three|some |3 | 4 |four |think |3 | 5 |five |some |3 | 6 |six |think |1 | 
  • output by ID if the ID and name in both tables are the same. - Shwarz Andrei
  • but in the num column there are several identical values ​​and you need to output them all - mlt2020
  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky
  • Describe the task itself. You may have a problem because the ID is not necessarily assigned in order. In the process of entering new data and deleting it, the ID will be assigned to the next account, not the position in the table. And to solve your problem, familiarize yourself with the DBMS section — selection for a one-to-many connection - pavlofff

0