cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Combining SQL Table Queries

ashleyg
1-Newbie

Combining SQL Table Queries

Hi All,

I am wanting to query an SQL Database which has several Tables within it and output an InfoTable with certain columns from different Tables.

Is this possible in a single SQL Query Service or should I create a custom JavaScript service which manipulates several SQL Query service outputs?

Many Thanks  

Ashley

1 ACCEPTED SOLUTION

Accepted Solutions
ankigupta
5-Regular Member
(To:ashleyg)

Hi Ashley Gibson​,

Yes, it is possible in a single SQL Query Service.

I just tried following query from ThingWorx for my sql and it gives expected result.

SELECT `testtable1`.`field1`,

              `testtable2`.`field2`

FROM `MySqlTestDB`.`testtable1`, `MySqlTestDB`.`testtable2` where `testtable1`.`field1`= `testtable2`.`field2`;

I hope it helps.

Thanks,

Ankit Gupta

View solution in original post

2 REPLIES 2
ankigupta
5-Regular Member
(To:ashleyg)

Hi Ashley Gibson​,

Yes, it is possible in a single SQL Query Service.

I just tried following query from ThingWorx for my sql and it gives expected result.

SELECT `testtable1`.`field1`,

              `testtable2`.`field2`

FROM `MySqlTestDB`.`testtable1`, `MySqlTestDB`.`testtable2` where `testtable1`.`field1`= `testtable2`.`field2`;

I hope it helps.

Thanks,

Ankit Gupta

Hi Ankit,

Many thanks for this input!

Ashley

Top Tags