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 228521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:41:21+00:00 2026-05-11T19:41:21+00:00

I am trying to write this, query with zf select but without success SELECT

  • 0

I am trying to write this, query with zf select but without success

SELECT * FROM `subscribers` WHERE id IN (Select subscriber_id From gs_relations Where group_id=55) 

I was trying with ssomething like this:

$gs_relations = new GSRelations();
$part = gs_relations->select()->from('gs_relations',subscriber_id')->where("group_id=$group_id");
$select = $this->select()->setIntegrityCheck(false);
return $select->where('id IN ('.$part->__toString().')');

Anybody can help me to solve the problem!?

  • 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-11T19:41:21+00:00Added an answer on May 11, 2026 at 7:41 pm

    This should do it:

    $gs_relations = new GSRelations();
    $part = $gs_relations->select()->from('gs_relations','subscriber_id')->where('group_id = ?',$group_id);
    $select = $this->select()->setIntegrityCheck(false);
    $select->from('subscribers')->where('id in (' . $part->__toString() . ')');
    return $select;
    

    print_r($select->__toString());

    Output:

    SELECT `subscribers`.* FROM `subscribers` WHERE (id in (SELECT `gs_relations`.`subscriber_id` FROM `gs_relations` WHERE (group_id = 55)))
    

    Do let me know how it goes, I used the below code for testing, but did not test executing the actual query as I have no such data structures:

    $groupId = 55;
    $part = $this->db->select()->from('gs_relations','subscriber_id')->where('group_id = ?',$groupId);
    $select = $this->db->select()->from('subscribers')->where('id in (' . $part->__toString() . ')');
    print_r($select->__toString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a select query from one single table in SQLite
I could probably write this myself, but the specific way I'm trying to accomplish
I'm trying to write a query that gives me a percentage (i.e. something like
I am trying to write a query with some fancy joins. I know this
I'm trying to write Linq query on this Products table based on FacetTypes that
I'm trying to figure out how to write this function: template <typename Bound> Bound::result_type
I'm trying to write a python script that packages our software. This script needs
This is more of a syntax question I'm trying to write a store procedure
I hope this question is not a RTFM one. I am trying to write
I'm trying write a query to find records which don't have a matching record

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.