简体   繁体   中英

Option box table only searchs with number on SQL (MS-Access)

I have made a table with placements. It says

  1. New York
  2. Washington

I use the table in another table and form where the user can select a city. But when I try to query the selected value with SQL, I can only search on the ID. Like

SELECT Articles.Name
FROM Articles
WHERE (((Articles.Placement.Value)=1);

I would like to search by name instead. How is that done? I simply can't find any info on that anywhere.

 SELECT Articles.Name
    FROM Articles
    WHERE (Articles.Placement="New York");

I think you just want a JOIN :

SELECT a.Name
FROM Articles as a INNER JOIN
     Placements as p
     ON a.Placement_ID = p.Placement_Id
WHERE p.Placement = "New York";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM