ccrevcypsys Posted November 2, 2007 Share Posted November 2, 2007 I have a website that has users and artists on it. I am building the community page ( the page that displays everyone in the db) well i figured out the view all artists and all people but i need help figuring out how to just view the customers without the artists on the page. My db is set up like this --|customers|-- --|artists|-- screenname +---customer_id email points password customer_id ---+ and my code for the query is this so far $query = "SELECT * FROM ".$glob['dbprefix']."StreamRush_customer LEFT JOIN ".$glob['dbprefix']."artist ON ".$glob['dbprefix']."StreamRush_customer.customer_id=".$glob['dbprefix']."artist.customer_id WHERE private = 0 ORDER BY noOrders"; Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 2, 2007 Share Posted November 2, 2007 select ".$glob['dbprefix']."StreamRush_customer.* FROM ".$glob['dbprefix']."StreamRush_customer LEFT JOIN ".$glob['dbprefix']."artist ON ".$glob['dbprefix']."StreamRush_customer.customer_id=".$glob['dbprefix']."artist.customer_id WHERE private = 0 ORDER BY noOrders"; or select only one table select * from ".$glob['dbprefix']."StreamRush_customer where etc..... Quote Link to comment Share on other sites More sharing options...
Barand Posted November 3, 2007 Share Posted November 3, 2007 IF you mean those customers without a matching artist record (using aliases to make the query legible, and line breaks so you don't need a 45 inch plasma screen to view) <?php <?php $query = "SELECT * FROM ".$glob['dbprefix']."StreamRush_customer c LEFT JOIN ".$glob['dbprefix']."artist a ON c.customer_id = a.customer_id WHERE private = 0 AND a.customer_id IS NULL ORDER BY noOrders"; ?> BTW - where did "private" and "noOrders" appear from? Quote Link to comment Share on other sites More sharing options...
ccrevcypsys Posted November 5, 2007 Author Share Posted November 5, 2007 they where on the db but i didnt put them on this because theres like 20 rows of info Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.