G
G
gistol2019-04-03 13:27:10
Zend Framework
gistol, 2019-04-03 13:27:10

How to make a Join query to the database, where the ID value is stored in a comma-separated list?

Greetings, help me form a database query using ZendDB.
There are two tables:
NAME ADDRESS Course
------------------------------------------- -----
RAM ADDRESS ,01,02,06,
HARI ADDRESS ,2,6,
JEFF ADDRESS ,3,5,6,7,
DAISY ADDRESS ,3,
Id Name Category
---------- -------------
1 ABC IT
2 DEF IT
3 GHI WEB
4 JKL IT
5 MNO WEB
6 PQR WEB
7 STU IT
I need the result to be a merge of 2 tables:
NAME ADDRESS Course
------------------------------- -----------
RAM ADDRESS ['id', 'name', 'category' ]
HARI ADDRESS ['id', 'name', 'category' ]
JEFF ADDRESS ['id', 'name ', 'category' ]
DAISY ADDRESS ['id', 'name', 'category' ]
Using Zend DB to build the query.

$select = $db->select();
$select->from(array('university' => 'object_query_1'), array('*'));
$select->join(array('course' => 'object_query_2'), '??????????????????????', array('*'));
$universities = $select->query()->fetchAll();

Please help me to understand and make the right request.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-04-03
@inoise

Normalize the base. No need to store information separated by commas

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question