Ok, I have a bit of a problem with some SQL I'm trying to build. I have a
table of Tickets, and then a table with a list of "fields" that are
associated with tickets. Here are some values for the "fields" table:

TicketID   FieldID   Value
1               1             Hello
1               2             5
2               1             Hello
2               3             Boo
3               2             5

What I want to do is select the TicketID's that have a "(FieldID = 1 AND
Value LIKE 'Hello') AND (FieldID = 2 AND Value = 5)". In this case I would
want Ticket #1 returned. But obviously, this string does not work in the
WHERE clause of my query. What I'm wanting to create is a search where
people can search different FieldID's and their values, and ONLY those
TicketID's matching ALL of the specified fields/values will be returned. I'm
having no luck doing this as each value/field pair is its own row. Besides
using CF to manipulate the data, can I do this in SQL?

Cedric
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to