Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2009-06-17 : 06:11:45
|
| Using a great left join connection where ~500,000 rows are either NULL or something important on one side or the otherNULL goodgood NULLNULL goodall the way down on 6 columns, keeping the tables apart. But I need to get rid of all the BOTH NULL rows. What's the syntax for that?using:where prcode is not null and stkcode is not nullI get no rows. Shoulda tried ORNeed to quickly give the boss financial data for comparison. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-17 : 06:17:18
|
shows us your query KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-17 : 06:40:12
|
AND NOT (Col1 IS NULL AND Col2 IS NULL) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2009-06-17 : 07:23:49
|
| This did itselectdistinctprcode, stkcode,det_quantity,det_unit_price,pr_price, stk_baseprice,det_nett,det_curr_nett,det_gross,det_VAT,st_nett,det_date_putinfrom sl_pl_nl_detail detleft join prc_price_recs p on p.prcode = det.det_price_codeleft join stk_stock s on s.stkcode = det.det_stock_codeinner join sl_transactions st on det.det_header_ref = st.st_header_refwhere prcode is not null or stkcode is not nullorder by det_date_putin |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-17 : 07:45:55
|
1. Run your query three times.2. Write down the time for fastest execution.3. Replace your WHERE clause with the one suggested 06/17/2009 : 06:40:12 4. Run edited query three times5. Write down the time for fastest execution.6. Post the results here.I have a hunch that my suggestion with AND will be a little faster than the suggestion with OR. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|
|
|