Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: PHP/MySQL Query

  1. #1
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts

    Question PHP/MySQL Query

    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.

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,096
    Thanks
    2
    Thanked 23 Times in 23 Posts
    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?
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    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.

  • #4
    New Coder
    Join Date
    Jul 2005
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by BaDgEr; 02-15-2006 at 02:45 PM.

  • #5
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    Thanks for that it works a treat.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •