Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i ORDER BY most matches in a record

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi everybody, i am sorry to bother you...i have an sql question <br><br>i am doing a search routine using the following sql: <br><br>select distinct BRITEM,BRDESC,BRPIC1,BRPHAS,BRLINK,BRDROP,BRSTCK,BRCNTP,<br>BRXSEL,BRNPRC,BRIPCK,BROPCK,BRSALE,BRSNAM,BRSEQ#,BRGFTC,<br>BRFACE,BRFIXD,BRSHPV from pwbits left outer join LINVRF01 on BRITEM = IRITEM <br><br>where ((UCASE(BRITEM) like 'LIK%' or UCASE(BRITEM) like '% LIK%' or UCASE(BRKWR1) like 'LIKE%' or UCASE(BRKWR2) like 'LIKE%' or UCASE(BRKWR3) like 'LIKE%' or UCASE(BRDESC) like 'LIK%' or UCASE(BRDESC) like '% LIK%' or UCASE(IRVITM) like 'LIK%' or UCASE(IRVITM) like '% LIK%') <br><br>or <br><br>(UCASE(BRITEM) like 'CHE%' or UCASE(BRITEM) like '% CHE%' or UCASE(BRKWR1) like 'CHEES%' or UCASE(BRKWR2) like 'CHEES%' or UCASE(BRKWR3) like 'CHEES%' or UCASE(BRDESC) like 'CHE%' or UCASE(BRDESC) like '% CHE%' or UCASE(IRVITM) like 'CHE%' or UCASE(IRVITM) like '% CHE%')) <br><br>and BRSALE = 'Y' and BRCMP# = 001 and BRWEBN = 4 and (20000803 >= BRSDTE and 20000803 <= BREDTE) and (BRPHAS <> 'Y' or (BRPHAS = 'Y' and 20000803 <= BRPDTE)) order by BRITEM for fetch only <br><br>basically its a web search engine...i am searching for any items that <br>have the words 'like' or 'cheese' <br><br>my problem is that i would like to show first the records that have both words and then the the records<br>that have just one of the words...you know sort <br>of a percentage search thing.... <br><br>is it possible in sql with a select statement...the table is already created... <br><br>thanks before hand and sorry about taking your time, <br><br>adiel
 
Try the sql forum <p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top