View Full Version : PHP/MySQL Query
02-15-2006, 02:03 PM
i currently have a query that i want to run another query, here is the code..
SELECT * FROM tbl_insulationteams
i know this is really simple but i have never done it before and am no sure how the code is properly written.
02-15-2006, 02:23 PM
Are you trying to retrieve values from two tables? If so, you need to post more details. What does your database look like and what values are you trying to return?
02-15-2006, 02:28 PM
No i am trying to use values from one query to alter the outcome of the second one. I was told you could write a query like this.
02-15-2006, 03:42 PM
It would help a lot if you described your situation - what exactly do you want the query to show? What's in the table you specified? What other information do you need to get to make that query work?
If you want to, say, find the ID of a worker, then find their shifts in another table, you'd use a nested query.
I'm not sure if this works with mysql, but for mssql you'd use something like
SELECT * FROM shifts WHERE worker_id IN (SELECT worker_id FROM workers WHERE worker_name = 'Jon')
This would give you all of Jon's shifts.
02-16-2006, 10:13 AM
Thanks for that it works a treat.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.