completevirtual Posted October 3, 2016 Share Posted October 3, 2016 Hello. I'm trying to create a mysql query to pull some data for a powershell script I'm working on. It works great UNTIL a client orders a 2nd product. Then the tblclients table no longer has the same amount of records as the tblorders and tblhosting tables. This is an issue since I joined the tblhosting and tblclients tables using 'id'. The tblorders and tblhosting tables have 'userid' but unfortunately it isn't in tblclients. The tblclients table has 'uuid' but I don't see any tables that tie the 'uuid' to 'userid'. Does anyone know how I could accomplish pulling in the correct client data for an order? This is the query I have so far. Thanks in advance for any assistance you can provide. select tblorders.userid, tblorders.id, tblhosting.domain, tblorders.status, tblclients.email, tblclients.companyname, tblcustomfieldsvalues.value from tblorders LEFT JOIN tblhosting ON tblorders.userid=tblhosting.userid LEFT JOIN tblclients ON tblhosting.id=tblclients.id LEFT JOIN tblcustomfieldsvalues ON tblorders.id=tblcustomfieldsvalues.relid where tblorders.status = 'Pending' group by tblorders.status;" Thanks, Kelvin 0 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.