Using sql like to choose a pattern and exclude a pattern


 
Thread Tools Search this Thread
Top Forums Programming Using sql like to choose a pattern and exclude a pattern
# 1  
Old 02-04-2011
Using sql like to choose a pattern and exclude a pattern

Hi, I am writing an sql query in which i have to choose only that url that are from particular host but are not zip files. something like:

Code:
select * from mytable where url like '%myhost%' and url not like '%zip%'

Is there a simple way to combine these two condition into one?
# 2  
Old 02-04-2011
Are you worried about performance?
Making the query "shorter" does not improve performance necessarily.

Otherwise I do not understand what you are trying to do.
# 3  
Old 02-05-2011
Jim, I had an impression tying the two condition together will improve performance. If that is not necessarily the case, I will go with current syntax
# 4  
Old 02-05-2011
Your sql is fine, otherwise, assuming it gives you the correct resultset
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

2. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

3. Shell Programming and Scripting

Global Pattern - exclude directories

All, I am trying delete folder by adding pattern not to delete certain folders. But i struck with error. When i use below command from command line, it works fine. shopt -s extglob rm -rf !(test1|test2|test3) But when i use the same in shell script, i get the below error. syntax... (6 Replies)
Discussion started by: vino_hymi
6 Replies

4. UNIX for Dummies Questions & Answers

Match Pattern after certain pattern and Print words next to Pattern

Hi experts , im new to Unix,AWK ,and im just not able to get this right. I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies

5. Programming

pl sql . pattern matching problem

hi everyone i am facing a strange problem declare v_var number(10); begin if( regexp_like('RCDORMS_MMS_*_DAR','RCDORMS_MMS_*_DAR')) then v_var:=20; dbms_output.put_line(v_var); end if; end; / please tell me what's the wrong thing in this expression.. as i am not able to get... (1 Reply)
Discussion started by: aishsimplesweet
1 Replies

6. Shell Programming and Scripting

Regular Expression to exclude pattern

Hi All I am using regular expressions to determine how to group certain data. I've included an example of the data below. USD_SPTR_2Y_725.5_PUT_EUROPEAN_09Q1|USD||European| CAD_NDX_10Yx1Y_5.5_PUT_EUROPEAN_09Q1|CAD||European| The regular expressions I am using is as follows and this is... (5 Replies)
Discussion started by: kingpin2502
5 Replies

7. Shell Programming and Scripting

search a pattern and if pattern found insert new pattern at the begining

I am trying to do some thing like this .. In a file , if pattern found insert new pattern at the begining of the line containing the pattern. example: in a file I have this. gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies

8. Shell Programming and Scripting

ls exclude pattern

Hello, With ls *.html I am getting all the files ending with html; what would be the best why to get all the files not ending with html? Thanks (2 Replies)
Discussion started by: JCR
2 Replies

9. UNIX for Dummies Questions & Answers

exclude columns with a matching line pattern

Hi , I have 5 columns total and am wanting to search lines in columns 3-5 and basically grep -v patterns that match 'BBB_0123' 'BVG_0895' 'BSD_0987' Does anyone know how to do this? I tried combining grep -v with grep -e but, it didn't work. Thanks! (5 Replies)
Discussion started by: greptastic
5 Replies

10. Shell Programming and Scripting

grep - to exclude lines beginning with pattern

11132 13069 11137 11142 13070 Can I use grep command to exclude all lines beginning with 13? I dont want to use grep -v 13 as potentially there will be a number with something like 11013 that I would exclude in error.. (2 Replies)
Discussion started by: frustrated1
2 Replies
Login or Register to Ask a Question