Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

How to get query results?

$
0
0

Hello,

I have a query I need to write and I am having some major troubles. Basically, the table works as follows. Inside the table, there are codes that are tracked on all of our assets. Example below:

Table name: codes

| Employee | Code | Completed? YN

| Joe Doe | IN | N

| James Joe | IN | N

| Jill James | IN | Y

Basically, each employee needs a code with IN with the code COMPLETED YN? as N active at all times. (don't blame me for poor db design) I haven't really figured out a way to query which users DON'T have a code of IN in the system that is a N for COMPLETED? YN.

Please help? Is this even possible?

EDIT:

Please note a user can have CODE OF IN with Y multiple times (due to the code expiring and needing to be entered after the expiration date).


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>