M
mattdaddym
Hi all,
My query writing skills are very basic. Any help is appreciated. Here
is the relevant info from the DB.
We have a Windows application that contains employee information like
favorite color, favorite movie, favorite book, etc... Once the
information is entered, it goes into a SQL database. Let's say the GUI
looks something like this:
Name: John Doe
Favorite Color: Green
Favorite Movie: Lord of the Rings
Favorite Book: Cat in the Hat
The name goes into a NAME table and is assigned a unique NAMEID
(integervalue). The rest of the info goes into a UDF table, but it is
not organized into columns like I would expect. Let's say John Doe's
NAMEID is 12345 for argument's sake. Here is what he looks like in the
UDF table.
nameid - 12345 udfnum - 1 udftext - Green
nameid - 12345 udfnum - 2 udftext - Lord of the Rings
nameid - 12345 udfnum - 3 udftext - Cat in the Hat
As you can see, the udfnum field corresponds to the row from the
windows form. I would have expected to see columns/fields names after
the rows in the windows form. This would have given me 1 row for each
name ID. Now I have multiple rows for each nameid. If a row is left
blank in the Windows form, I do not get a row for this udfnum in the
udf table. It is just missing.
Here is what I want to query. I would like to find all nameid that did
not have a favorite book entered. In other words...query all NAMEIDs.
For each NAMEID, check to see if there is a UDFNUM value of 2. If this
does not exist, then I would like to see everything for this nameID.
I hope I was clear. This is tricky for me. It is a much easier query
if there were columns called (color, book, movie, etc...). Thanks for
any and all help!!!
My query writing skills are very basic. Any help is appreciated. Here
is the relevant info from the DB.
We have a Windows application that contains employee information like
favorite color, favorite movie, favorite book, etc... Once the
information is entered, it goes into a SQL database. Let's say the GUI
looks something like this:
Name: John Doe
Favorite Color: Green
Favorite Movie: Lord of the Rings
Favorite Book: Cat in the Hat
The name goes into a NAME table and is assigned a unique NAMEID
(integervalue). The rest of the info goes into a UDF table, but it is
not organized into columns like I would expect. Let's say John Doe's
NAMEID is 12345 for argument's sake. Here is what he looks like in the
UDF table.
nameid - 12345 udfnum - 1 udftext - Green
nameid - 12345 udfnum - 2 udftext - Lord of the Rings
nameid - 12345 udfnum - 3 udftext - Cat in the Hat
As you can see, the udfnum field corresponds to the row from the
windows form. I would have expected to see columns/fields names after
the rows in the windows form. This would have given me 1 row for each
name ID. Now I have multiple rows for each nameid. If a row is left
blank in the Windows form, I do not get a row for this udfnum in the
udf table. It is just missing.
Here is what I want to query. I would like to find all nameid that did
not have a favorite book entered. In other words...query all NAMEIDs.
For each NAMEID, check to see if there is a UDFNUM value of 2. If this
does not exist, then I would like to see everything for this nameID.
I hope I was clear. This is tricky for me. It is a much easier query
if there were columns called (color, book, movie, etc...). Thanks for
any and all help!!!