The tag has no usage guidance.

learn more… | top users | synonyms

2
votes
1answer
60 views

Why does coalescing make this query quicker?

I have the following query SELECT SQL_NO_CACHE `table1`.* FROM `table1` LEFT JOIN `table2` ON table2.id = table1.table2_id WHERE (`table2`.`date_assigned` >= '2015-06-21') AND ( ...
0
votes
1answer
23 views

Joining Oracle tables with 2 strings to be oa a single row (in a distinct SQL filter)

I have an Oracle Database and if I fire that SQL: SELECT distinct RAP.ID_PL, SES_RAP.AN, RAP.DENUMIRE, A3T2.COD_DESEU, A3T2.TIP_AMB, A3T2.COD_REC, A3T2.COD_VAL FROM chest cht INNER JOIN ...
1
vote
1answer
25 views

oracle database filter with full outer join and coalesce intersect

in a Oracle Database if I "shoot" SELECT RAP.IDPL, C41.TIP_COD_DESEU AS CD41,C41.STOC_VAL AS CANT41, C42.TIP_COD_DESEU AS CD42,C42.STOC_VAL AS CANT42, C43.TIP_COD_DESEU AS ...
0
votes
1answer
58 views

joining tables with full outer join and… COALESCE?

I have a few tables in an Oracle database linked by id - fk_id, if I do: select RAP.ID_PCT_LUCRU,SES_RAP.AN, TIS.CANT as c1,'R12' as modc1, TIT.CANT as c2,'D13' as modc2, ...
1
vote
1answer
122 views

Full outer joins, coalescing, indexes and views

I have two tables, let's call them TableA and TableB. TableA TableB ------ ------ ID ID Date Date Foo Bar Both tables ...
0
votes
1answer
73 views

Coalesce per row - get all Detail IDs grouped per HeaderRow e.g. Invoice1 | 1,2,3 Invoice 2 | 4,5,6

I have the following demo data (taken from Adventureworks) SalesOrderNumber SalesOrderDetailID SO43659 12 SO43659 11 SO43659 8 SO43659 9 SO43660 ...
58
votes
8answers
5k views

Does SQL Server read all of a COALESCE function even if the first argument is not NULL?

I'm using a T-SQL COALESCE function where the first argument will not be null on about 95% of the times it is ran. If the first argument is NULL, the second argument is quite a lengthy process: ...