You are here: Re: Narrowed Down Search « MsSQL Server « IT news, forums, messages
Re: Narrowed Down Search

Posted by Ed Murphy on 05/10/07 15:02

Looch wrote:

> I have a three text boxes in a VB app that I want to use as criteria
> for a query.
>
> txt1 = Serial Number
> txt2 = Ship Date
> txt3 = Item Description
>
> All three item attributes (txt1 - 3) are columns in table that
> includes much more information (Customer Name, Address, etc). Granted
> this isn't ideally following the relationtional model.
>
> If the user knows the Serial Number, that will return one record which
> would be great. If they know only the Item Description that may return
> 100 records. If they know the Item Description and Ship Date that may
> narrow it down to 25 records. I don't want to require txt1 - 3 be
> included in the query but if the information is available than it
> would be used in the query to help narrow down the search.

select <columns>
from <table>
where (@sn is null or sn = @sn)
and (@sd is null or sd = @sd)
and (@desc is null or desc = @desc)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация