Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 WHERE for array?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

7 Posts

Posted - 08/27/2012 :  08:25:48  Show Profile  Reply with Quote
Firstly, sorry if this is the wrong section, maybe even the entirely wrong place for this. I am new to both phpmyadmin and sql and honestly have no idea, what category my problem best fits into and if it even belongs here at all.

I am trying to fetch all orders with a specific payment method from my database. This

SELECT `entity_id` FROM `sales_flat_order_payment` WHERE method = "cashondelivery"

will fetch the entity IDs of all relevant orders.
Another column includes these entity IDs next to the actual order numbers. So I am trying to find a way to fetch all entries from this second column, whose entity ID is included in the list of entity IDs fetched in the first step.
So basically I am looking for something like this:

SELECT `increment_id` FROM `sales_flat_order` WHERE entity_id = "<array of ids>"

Is something like that supported?
Thank you in advance!

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 08/27/2012 :  08:44:29  Show Profile  Visit webfred's Homepage  Reply with Quote
where entity_id IN(here comes your first select)

Too old to Rock'n'Roll too young to die.
Go to Top of Page

Starting Member

7 Posts

Posted - 08/28/2012 :  13:05:37  Show Profile  Reply with Quote
It seems so easy, now that I've seen the solution :)
Thank you so much!
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000