Basic SQL Query Help Needed

2009-08-25 Thread c...@hosting4days.com

I have a basic invoice table with related line items table

Goal :I'd like to get ALL the related line items - for ALL the  
'open' invoices...


-- this should get a list of open (unpaid) invoices

$query_invoice = "SELECT DISTINCT ID from invoices where status =  
'open'"


-

-- then I'd like to get ALL the line items - in ALL these 'open'  
invoices - so how do I write the next SQL statement :


$query_items = ??? "SELECT ID, NAME from lineitems where --xx??? 
xx--" ???




Thanks,
c...@hosting4days.com






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Is It Possible to create a Join with Multiple Tables

2009-09-25 Thread c...@hosting4days.com

:Newbie:
Short Question: Is it possible to create an inner join (or another  
join) with multiple tables?


something like

$query_list1 = "SELECT table1.id,table1.status, table2.id, table3.id  
(more here - etc.) FROM table1

INNER JOIN table2 ON table1.id = table2.id
INNER JOIN table3 ON table2.id = table3.id
WHERE table1.status = 'open'";


Q: Is something like this possible?



Thanks,
c...@hosting4days.com






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org