E
E
EVOSandru62015-08-04 08:15:14
Yii
EVOSandru6, 2015-08-04 08:15:14

How to transfer a query to a Yii model?

Good afternoon,
I'm wondering how it is possible to execute the following query in Yii

SELECT * FROM users WHERE id IN (SELECT o.user_id FROM orders o WHERE MAX(o.DATE) <= :DATE GROUP BY o.user_id)

1. With the receipt of the object model.
2. With the help of pure SQL and somehow pick up the data.
And I’m also interested in how to execute such a query using Yii and pick up count :
SELECT COUNT(mc_offers .bid_id) 
FROM mc_offers 
LEFT JOIN m_bids ON m_bids.id = mc_offers.bid_id 
WHERE m_bids.customer_id = 'x';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LIAL, 2015-08-04
@LIAL

I'm wondering how it is possible to execute the following query in Yii

yiiframework.ru/doc/guide/en/database.dao
or look at the query builder - which is easy to translate your query
look at the link to queryScalar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question