How to do concatenate in Python Script widget in Orange Data Mining software ?
table_1 = Table
table_2 = Table
how to concatenate table_1 and table_2 ?
Table.concatenate doesn't work?
table_12 = Table.concatenate([table_1, table_2], axis=0)
Related
Can you please help me in getting the below output using 2 different tables?
Table 1: has below data
Table 2: has below data
The output table should be with below data:
Please help me to achieve this output, Sorry if I missed anything
Thanks in Advance!!
You could split the sub-select into 3 separate queries and then use UNION to both "glue" the results set together and de-duplicate the results set where the name1 columns match between the two table e.g. "John".
Something like this :
insert into target(id,name1,name2,name3)
select src1.id,src1.name1,src2.name1,src1.name1
from src1
inner join src2 on src1.id = src2.id
where src1.name1 is not null
and src2.name1 is not null
union
select src1.id,src1.name1,src2.name1,src2.name1
from src1
inner join src2 on src1.id = src2.id
where src1.name1 is not null
and src2.name1 is not null
union
select src1.id,src1.name1,src2.name1,coalesce(src1.name1,src2.name1)
from table1 src1
inner join table2 src2 on src1.id = src2.id
where src1.name1 is null
or src2.name1 is null
order by 1
Handling the null values in a separate select since UNION will not de-duplicate null values
I'm attempting to update a table column based on the st_contains() results using two other tables. The code I've written below returns too many results. What do I need to change to make this work?
UPDATE "PRIMARY_USE_DESC"."CAD_Primary_Desc" SET "Parcel_Desc" = 'PARK'
WHERE (
SELECT geom_poly
FROM "Buda_Parks" t1
LEFT JOIN (
SELECT geom_point
FROM "HCAD_POINTS"
) t2 ON ST_Contains(t1.geom_poly, t2.geom_point)
) IS NOT NULL
Ok, I figured it out. Posting it here in case someone else has this question.
UPDATE "PRIMARY_USE_DESC"."CAD_Primary_Desc"
Set "Parcel_Desc" = 'PARK'
FROM
(select geom_poly from "Buda_Parks" t1
left join (SELECT geom_point FROM "HCAD_POINTS") t2 on ST_Contains(geom_poly,geom_point)) t3
WHERE ST_Contains(geom_poly, geom_point)
My query is working but it takes time to display the data. Can you help me to make it quick.
$sql="SELECT allinvty3.*, stock_transfer_tb.* from stock_transfer_tb
INNER JOIN allinvty3 on stock_transfer_tb.in_code = allinvty3.in_code
where stock_transfer_tb.in_code NOT IN (SELECT barcode.itemcode from barcode where stock_transfer_tb.refnumber = barcode.refitem)";
I would recommend using the following query:
SELECT
a.*,
s.*
FROM stock_transfer_tb s
INNER JOIN allinvty3 a
ON s.in_code = a.in_code
WHERE
NOT EXISTS (SELECT 1 FROM barcode b
WHERE s.refnumber = b.refitem AND s.in_code = b.itemcode);
If this still doesn't give you the performance you want, then you should look into adding indices on all columns involved in the join and where clause.
It seems an easy question but I am comparing a table contain random tables and columns with syscolumns
this query will give me the missing columns
select object_name(syscolumns.id) , syscolumns.name
from syscolumns
where not exists
(select 1
from CHECKINGTABLE
where object_name(CHECKINGTABLE.id) = object_name(syscolumns.id)
and CHECKINGTABLE.name=syscolumns.name)
and object_name(syscolumns.id) ='TAB1'
but in such way it will give me wrong results
select object_name(syscolumns.id) , syscolumns.name
from syscolumns , CHECKINGTABLE
where not exists
(select 1
from CHECKINGTABLE
where object_name(CHECKINGTABLE.id) = object_name(syscolumns.id)
and CHECKINGTABLE.name=syscolumns.name)
and object_name(syscolumns.id) =object_name(CHECKINGTABLE.id)
what I am doing wrong ? I want a query to compare a table I own with syscolumns to identify the missing data in my table
You could try the following. I do not have an ASE DB at hand but the syntax should be correct I hope.
SELECT syscolumns.id , syscolumns.name
FROM syscolumns LEFT OUTER JOIN CHECKINGTABLE
ON (CHECKINGTABLE.id = syscolumns.id
AND CHECKINGTABLE.name=syscolumns.name)
WHERE CHECKINGTABLE.name IS NULL
I am trying to do something like this in HIVE:
insert into table abc
select a.plc,b.direction
from (select c.plc from test t JOIN central c ON t.id = c.boxno) a ,
(select c.direction from test t JOIN central c ON t.id = c.boxno) b;
Please suggest what's wrong in this ?
I feel this query can be modified to obtain the result in a better way. Try this instead:
insert into table abc
select c.plc,c.direction
from test t
JOIN central c ON t.id = c.boxno;
Wont the required output be same? In case you are trying to achieve something else functionally, please elaborate.