SQL query

  • 15 years ago
    Hello, I have a DataBase Access 2002.  A Table_Card with a list of all cards (Card_Name)  and a Table_Card_Employee with Emp_ID and Employee_Card.  Those two related to a Table_Employee.

    I want to display in a ComboBox the list of the Card from Table_Card excluding those Cards already in
    Table_Card_Employee from a specific Emp_ID

    SELECT Table_Card.Card_Name FROM  Table_Employee INNER JOIN (Table_Card INNER JOIN Table_Card_Employee ON Table_Card.Card_Name = Table_Card_Employee.Employee_Card) ON Table_Employee.ID = Table_Card_Employee.Emp_ID
    WHERE (((Table_Card.Card_Name)<>[Table_Card_Employee].[Employee_Card])
    AND ((Table_Employee.ID)='U62404'))
    ORDER BY Table_Employee.ID;

    It shows me an empty query...!  any help

    Thank you

  • 15 years ago

    Not sure exactly how your schema is set up but try something like this:

    SELECT TableCard.CardName FROM  TableEmployee INNER JOIN (TableCard INNER JOIN TableCardEmployee ON TableCard.CardName = TableCardEmployee.EmployeeCard) ON TableEmployee.ID = TableCardEmployee.EmpID
    Employee.ID)='U62404' AND

    (TableCard.CardName) NOT IN Select EmployeeCard from TableCard_Employee

    ORDER BY Table_Employee.ID;

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...'” - Isaac Asimov