You are here: Re: T-SQL Problem « MsSQL Server « IT news, forums, messages
Re: T-SQL Problem

Posted by Tom Moreau on 03/21/06 02:37

UserDefinedField cannot be simultaneously 8 and 9. Therefore, you'll get no
rows. However, if you want *either* of the two pairs of criteria, then use:

SELECT
*
FROM
UserDefinedData
WHERE
(
[ENC_UserDefinedData].[UserDefinedField] = 8
AND
[ENC_UserDefinedData].[Value] LIKE '%Picasso%'
)
OR
(
[ENC_UserDefinedData].[UserDefinedField] = 9
AND
[ENC_UserDefinedData].[Value] = '48'
(


--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Jose" <discussions@avandis.co.uk> wrote in message
news:1142900337.913053.182560@e56g2000cwe.googlegroups.com...
Hi All,

Sorry if this seems incredibly basic but what is the syntax to solve
this query. I have a table (ENC_UserDefinedData) with 4 columns, ID,
UserID, UserDefinedField and Value. I want to select all the UserIDs
that match this criteria:

[ENC_UserDefinedData].[UserDefinedField] = 8
AND
[ENC_UserDefinedData].[Value] LIKE '%Picasso%'

AND

[ENC_UserDefinedData].[UserDefinedField] = 9
AND
[ENC_UserDefinedData].[Value] = '48'

Thanks in advance,

Jose

 

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

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