Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6016199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:56:55+00:00 2026-05-23T02:56:55+00:00

Assume that I have a table : students ______________________________________________________ |id | name | school

  • 0

Assume that I have a table : students

______________________________________________________
|id   | name           | school        | class        |
______________________________________________________
| 1   | John           | ABC           | C1           |
| 2   | Jack           | ABC           | C1           |
| 3   | Anna           | ABC           | C1           |
| 4   | Peter          | DEF           | D1           |
| 5   | Alex           | ABC           | C2           |
| 6   | Bryan          | ABC           | C2           |
| 7   | David          | ABC           | C2           |
| 8   | Cristian       | DEF           | D1           |
_______________________________________________________

Using this query :

 SELECT a.class,GROUP_CONCAT(a.name) as names FROM students a WHERE a.school='ABC' GROUP BY a.class 

give me this result :

 ____________________________
|class  | names             |
 ____________________________
| C1    | John, Jack, Anna  |
| C2    | Alex, Bryan, David|
 ____________________________

How can I execute this query in Zend Framework by using Zend_Db_Table or Zend_Db_Select?
Thank you so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:56:55+00:00Added an answer on May 23, 2026 at 2:56 am

    I guess it will be something like this. Try it.

    $table = Your_DbTable_Class();
    $select = $table->select()
              ->setIntegrityCheck(false)
              ->from(array('a' => 'students'), array( 'class' => 'class' , 'names' => new Zend_Db_Expr('GROUP_CONCAT(a.name)')) )
              ->where( 'a.school = ?', 'ABC' ) 
              ->group('a.class');
    

    When I assemble it, it gives me following query:

    SELECT `a`.`class`, GROUP_CONCAT(a.name) AS `names` FROM `students` AS `a` 
    WHERE (a.school = 'ABC')
    GROUP BY `a`.`class`
    

    Is it what you are looking for ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have a table structure like seen below location|name ------------- NY|john London|neil
To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck
I have a table that looks something like this: CREATE TABLE student_results(id integer, name
Please help me with a query. Assume that we have a table with columns:
Just something interesting come in my mind. Assume that we have a table (in
Assume that we have N erlang nodes, running same application. I want to share
Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database
I'm working on an assignment that is telling me to assume that I have
Let's assume I have a model called product. Let's assume that product has three
Assume I have an ASP.NET MVC app that's not doing anything too fancy (no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.