Join two query
I have a simple query in two tables of BD:
select A.id, A.name, A.uniqueid, B.name, A.phone, A.contact, A.category, A.model
from tc_devices as A
join tc_groups as B
on (B.id = A.groupid)
order by A.name;
with this I got: (example):----------------------------------------------------
id name(device) uniqueid name(group) phone contact category model
1 john 20 seller 0001 0001 boss xxxx
2 jane 30 seller 0002 0002 employee xxxx
------------------------------------------------------------------------------
I have a second query:
select distinct PositionsDevice, PositionsDevice from (
SELECT C.deviceid as PositionsDeviceid, C.protocol as PositionsOProtocolo
FROM tc_positions as C
order by id desc limit 200000
) x
;
with this I got: (example):----------------------------------------------------
PositionsDeviceid protocol
20 manager
30 operator
------------------------------------------------------------------------------
I am trying join the both, (no success until now) where uniqueid (first query) is equal PositionsDeviceid (second query)
to add a last column (protocol) as example below
I need have:---------------------------------------------------------------
id name(device) uniqueid name(group) phone contact category model protocol
1 john 20 seller 0001 0001 boss xxxx manager
2 jane 30 seller 0002 0002 employee xxxx operator
------------------------------------------------------------------------------
Any help will be appreciated!!!!!
Subject
Written By
Posted
Join two query
February 19, 2019 11:06AM
February 19, 2019 11:10AM
February 19, 2019 12:14PM
February 19, 2019 06:26PM
February 24, 2019 06:09AM
February 24, 2019 12:43PM
February 24, 2019 08:20PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.