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

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

nikl
Starting Member

Germany
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!

webfred
Flowing Fount of Yak Knowledge

Germany
8760 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

nikl
Starting Member

Germany
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  
 New 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.08 seconds. Powered By: Snitz Forums 2000