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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Combining SQL Table Queries

ashleyg
1-Visitor

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

ACCEPTED SOLUTION

Accepted Solutions
ankigupta
12-Amethyst
(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
12-Amethyst
(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

Announcements


Top Tags