Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Joining two tables with the same column


#1

Hi Guys, Is there a way to join two tables, I need to exclude a same column name with the same value from one table to another.
Select * from Table1, Table2 where Table1.column1 = table2.column1

Thanks!


#2

Hi, @Daniel.Pel: There are not really “tables” in Insights. Rather, there are event types; the data looks something like this:

+-----------------------------------------------------------------------------------------+
| timestamp  | eventType   | attributeName | attributeValue                               |
|------------|-------------|---------------|----------------------------------------------|
| 1563509304 | Transaction | name          | WebTransaction/SpringController/owners (GET) |
| 1563509304 | Transaction | appName       | New Relic Pet Clinic                         |
| 1563509304 | Transaction | duration      | 0.01                                         |
| 1563509310 | PageView    | appName       | New Relic Pet Clinic                         |
| 1563509310 | PageView    | pageUrl       | http://www.example.com/petclinic/owners.html |
| 1563509310 | PageView    | duration      | 0.63                                         |
+-----------------------------------------------------------------------------------------+

Because there are no tables, NRQL does not support JOINs. If you have two event types with the same attribute name, you can combine them (like a UNION):

SELECT average(duration) 
FROM PageView, Transaction 
WHERE appName = 'ecomm' 
FACET eventType()

#3

Hi @philweber
I see, thanks for the clarification regarding event types.
As for this one, I need to exclude the events that encountered an error.
Select * from Transaction, TransactionError where Transaction.column1 != TransactionError.column1
I’ve been trying to do something like this but it won’t work.
Am I missing something?
Thanks!


#4

Which language agent are you using? You may be able to just do this:

SELECT * 
FROM Transaction
WHERE error IS false

#5

I see, I tried using error IS false and it works but I’m confused,
does error IS false is the opposite of error IS true.
I tried to run SELECT * FROM Transaction WHERE error IS false
and it didn’t return any rows, while SELECT * FROM Transaction WHERE error IS true returned rows.
I checked the value of the column error and I saw that it has no value
Thanks


#7

Assuming you are referring to your Data Exchange application, it looks like only the flask_app:error_handler transaction sets the error attribute to true; the other transactions leave it undefined. You may use the following query to filter out these error transactions:

SELECT * 
FROM Transaction
WHERE name NOT LIKE '%flask_app:error_handler'

#8

Hi @philweber,
After trying, still it won’t work.
I’ll check our data and we’ll get back to you
Thanks!


#9

Thanks @Daniel.Pel - let us know what you find when you check out the data.


#10

Please try SELECT * FROM Transaction WHERE error IS NULL


#11

Hey @Daniel.Pel - do you have any update? Did Allan’s query help out with your needs?