Questions tagged [zend-db-select]
117 questions
                    
                    22
                    
            votes
                
                4 answers
            
        How to use distinct in Zend Framework 2?
How can I use the distinct clause with Zend\Db\Sql\?
         
    
    
        Emmanuel Gauthier
        
- 531
- 2
- 4
- 15
                    14
                    
            votes
                
                2 answers
            
        setIntegrityCheck in Zend Selects with joins
I was looking at some questions that ask how to do joins in Zend Framework queries, but the answer is always something like "just do setIntegrityCheck(FALSE)".
My question is: why do I need to do this?
It seems to me disabling "integrity checks" is…
         
    
    
        cambraca
        
- 27,014
- 16
- 68
- 99
                    11
                    
            votes
                
                3 answers
            
        Zend DB Selecting constants - columns that do not exist in table
I'm trying to do this query using Zend DB select but I'm not able to do so
This is the sql query
select shopping_id,shopping_details,"friend" as type
from shopping
Notice here how I'm specifying "friend" as type and friend is not a column in the…
         
    
    
        Gublooo
        
- 2,550
- 8
- 54
- 91
                    10
                    
            votes
                
                1 answer
            
        How can I join a subquery using Zend_Db_Select
How would I construct this query using Zend_Db_Select?:
SELECT users.user_id, email_address, t1.value as 'languages'    
FROM users
LEFT JOIN (
  SELECT
    user_id
    , field_id
    , GROUP_CONCAT(value SEPARATOR ',') AS value
  FROM…
         
    
    
        Oleg
        
- 2,733
- 7
- 39
- 62
                    7
                    
            votes
                
                2 answers
            
        Translating a query to use Zend_Db_Select
I'm having some problems translating this query to use ZF's Zend_Db_Select:
SELECT b.id, b.title, b.description 
FROM memberships AS m
JOIN blogs AS b ON b.id = m.blog_id 
WHERE m.user_id = ? 
ORDER BY m.created
LIMIT 0, 30
(this query works and…
         
    
    
        Ross
        
- 46,186
- 39
- 120
- 173
                    7
                    
            votes
                
                1 answer
            
        GROUP_CONCAT with JOINLEFT in Zend Db Select
Assuming that I have 2 tables
articles
  id              title
  1               Article 1
  2               Article 2
Images
  id              article_id     image
  1               1              a.png
  2               1              b.png
  3 …
         
    
    
        Nấm Lùn
        
- 1,277
- 6
- 28
- 48
                    6
                    
            votes
                
                2 answers
            
        How to use GROUP_CONCAT with Zend Framework?
Assume that I have a table : students
______________________________________________________
|id   | name           | school        | class        |
______________________________________________________
| 1   | John           | ABC           | C1  …
         
    
    
        Nấm Lùn
        
- 1,277
- 6
- 28
- 48
                    6
                    
            votes
                
                2 answers
            
        Zend Framework: How to do a DB select with multiple params?
I'm just wondering what the syntax is to do a db select in Zend Framework where two values are true. Example: I want to find if a user is already a member of a group:
$userId = 1;
$groupId = 2;
$db = Zend_Db_Table::getDefaultAdapter();
$select = new…
         
    
    
        Andrew
        
- 227,796
- 193
- 515
- 708
                    5
                    
            votes
                
                5 answers
            
        Count on Zend_Db_Select
Say I have a random zend_db_select object.
How can I perform a count on that object, so I know the amount of items that meet the query.
I tried the following:
$data->TotalRecords = $select->columns(new…
         
    
    
        brechtvhb
        
- 1,029
- 2
- 13
- 26
                    5
                    
            votes
                
                4 answers
            
        Zend PDO error - how can I debug it?
I have a weird problem using Zend Framework and Mysql. I generated a query:
SELECT events.idUser, szForename, szLastname, readers.szName, idZoneFrom, events.dtTime FROM events, users, readers WHERE events.idUser = users.idUser AND events.idReader =…
         
    
    
        Tomasz Kapłoński
        
- 1,320
- 4
- 24
- 49
                    5
                    
            votes
                
                2 answers
            
        Zend Framework: How to combine three tables in one query using Joins?
I have three tables like this:
Person table:
person_id |    name     |   dob
--------------------------------
    1     |   Naveed    |  1988
    2     |   Ali       |  1985
    3     |   Khan      |  1987
    4     |   Rizwan    |  1984
Address…
         
    
    
        Naveed
        
- 41,517
- 32
- 98
- 131
                    5
                    
            votes
                
                2 answers
            
        Best way to do an Inner Join using the Zend Framework?
It seems like there's a few different ways to join two tables using the Zend Framework, but I've never done it before so I don't know which is the best way to do it.
This is what I'm trying to do...
I have 3 tables in my database:
users
    ( id ,…
         
    
    
        Andrew
        
- 227,796
- 193
- 515
- 708
                    5
                    
            votes
                
                3 answers
            
        How to write a subquery refactoring WITH clause using Zend framework?
I want to use the WITH syntax inside the SQL query in Zend framework, the SQL looks like this:
WITH t AS
(SELECT item_id, row_number() OVER (ORDER BY some_criteria DESC) rn
   FROM orders)
SELECT t2.rn, t2.item_id
  FROM t t1 JOIN t t2 ON (t2.rn >…
         
    
    
        Capitaine
        
- 1,923
- 6
- 27
- 46
                    4
                    
            votes
                
                2 answers
            
        Multiple/nested "select where" with Zend_Db_Select
Possible Duplicate:
Grouping WHERE clauses with Zend_Db_Table_Abstract 
I need to create something like this:
select name from table where active = 1 AND (name LIKE 'bla' OR description LIKE 'bla')
The first part is easy:
$sqlcmd =…
         
    
    
        Reyo
        
- 148
- 3
- 11
                    4
                    
            votes
                
                1 answer
            
        Zend DB fails emulating limit and offset for MS SQL
I'm using Zend Framework 1.12 to access a MSSQL 2008 server.  I'm using FreeTDS as the database driver. 
I'm using Zend_Db to generate the following query.  
 $obj_sel = $obj_db
          -> select ()
          -> from (array ('ps' =>…
         
    
    
        GordonM
        
- 31,179
- 15
- 87
- 129