Jump to content

Recommended Posts

Good Morning,

 

I have an issue where I need some guru help on (if possible :) ) I'm trying to Query across two tables in which have data that I need from both...

 

The tables are:

 

results

user_agents

 

I'm querying specific fields from the table results, but I want to also identify the user agent that is in the results field with all its data from the user_agents table..

 

So here's what I have so far:

 

Select result_date, ip_address, user_agent_id, latency from results where ip_address = inet_aton('10.10.120.120');

 

It brings back all the results from the IP i'm looking for, but there are 8 user_agent_id's associated with it.. I want to ID each user agent on each row with who they are from the user_agent table. I can't seem to get the syntax right and am wondering if someone could help me with that?

 

A sample of the output is as follows:

 

result_date * ip_address * user_agent_id * latency

4/13/2010 12:29:40 PM 111111111 1035332 40

 

If I query just the user_agent_id shown, I get:

 

user_agent_id user_agent os device platform browser_id browser_name browser_version

1041842 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Windows 7 pc windows Firefox 3.6.3 Firefox 3.6.3

 

Thank you!

 

 

Link to comment
https://forums.phpfreaks.com/topic/198388-my-sql-command-query-help-needed/
Share on other sites

I forgot to add my other code for retreving my agent info:

 

Select * from user_agents where user_agent_id = ('1041842');

 

I want to query all from the results table that is associated with an IP address but also define what each agent represents to the right of each row.

 

result_date                 ip_address user_agent_id latency

4/13/2010 12:49:55 PM 4445563843 2152 93

4/12/2010 3:48:26 PM 4445563843 15042 42

4/13/2010 1:52:41 PM 4445563843 1035332 40

 

As you can see from a snipit from my results table, I am getting three different user agents to that one IP. I want it defined right past my latency field on each row so I know who it is.

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.