Good day. There is a code that receives a list of areas from the database:

$db = JFactory::getDbo(); $db->setQuery('SELECT DISTINCT aoguid, offname FROM ADDROBJ_NN WHERE (livestatus = 1 AND aolevel = 3) OR (AOLEVEL = 4 AND LIVESTATUS = 1 AND PARENTGUID = "88cd27e2-6a8a-4421-9718-719a28a0a088") ORDER BY offname'); $rows = $db->loadObjectList(); foreach ($rows as $row) { $options[] = JHTML::_('select.option', $row->aoguid, $row->offname); } return $options; 

data is displayed in the 1st select , in the 2nd select settlements are loaded according to the selected area. But there is such a problem as urban districts. They must enter both the districts and the cities. How to make a request (assuming that I only supplement the where part of the request, so that with the Арзамас area selected for example, in the second select , I’ve got out not only localities included in his district, but also the г.Арзамас (such . pieces 10) ??? all data (districts, cities and streets are in the same table, parsing from the FIAS base). The Fabrik component is used. enter image description here I tried it this way, but it does not work out ... it turned out that everything was done by force everywhere. inset

 `aolevel=6 or aoguid='555e7d61-d9a7-4ba6-9770-6caa8198c483' or aoguid='7e42f157-87d6-4111-a406-17432e814723' 

etc. in the Where query field, but this is not an option.

enter image description here

  • The table structure and data samples are not specified in the question, so I can only assume that in one of OR you need a subquery to the same table, something like ... OR (parentguid in(select guid from ADDROBJ_NN where parentguid='nnnnn') - Mike
  • @Mike, added the screen part of the table, but I'm afraid that without knowledge of the Fabrik component for Joomla no one will help me here (((There cannot be used where and and , I hoped that with the second select it will be possible, but not. - medvedev
  • Hm but you have an example where in the example ... - Mike
  • @Mike, this is a request for the first select , as I understand it in the future (see the first screen) all the conditions are substituted for this request, and we can change only the where . On this and wrote that without understanding Fabrik, apparently it is impossible to help me. Thanks for the answer! - medvedev

0