Skip to main content
1-Visitor
November 8, 2016
Solved

Combining SQL Table Queries

  • November 8, 2016
  • 1 reply
  • 1443 views

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

Best answer by ankigupta

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

1 reply

ankigupta5-Regular MemberAnswer
5-Regular Member
November 8, 2016

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

ashleyg1-VisitorAuthor
1-Visitor
November 8, 2016

Hi Ankit,

Many thanks for this input!

Ashley