...

View Full Version : SQL statement in a field



chornbeck
10-21-2011, 06:01 PM
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?

dan-dan
10-21-2011, 08:28 PM
Can you post your code so far?

chornbeck
10-21-2011, 08:40 PM
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...

Old Pedant
10-21-2011, 10:31 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum