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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    138
    Thanks
    11
    Thanked 0 Times in 0 Posts

    SQL statement in a field

    Know this is prob simple, but I can't get my head around it... I need to have a field in a client database row called "number of calls" that queries another table, a call log, and counts the number of calls made to that client.

    So I would like to insert the SQL to check the call log in the "number of calls" field and have it update and check the call log for the value each time the row is queried... I also need to figure out how to use the variable from the current row, in this case phone number, to make the query.

    Any help?
    Last edited by chornbeck; 10-21-2011 at 06:04 PM.

  • #2
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    Can you post your code so far?

  • #3
    Regular Coder
    Join Date
    Feb 2006
    Posts
    138
    Thanks
    11
    Thanked 0 Times in 0 Posts
    The code would just be the query - I'm trying to find out how you can use code instead of regular contents for a field so it updates the field in realtime via the query...

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,633 Times in 4,595 Posts
    You can't.

    Or at least not easily.

    Instead, you use a JOIN in your query.

    Show the list of fields in the two tables. It's a trivial problem if you use a JOIN.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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