Access nested query statements, the master helps!! 60

Updated on technology 2024-04-15
9 answers
  1. Anonymous users2024-02-07

    sql1="

    select *

    from Product Sales Sheet.

    where Sell Order Number in (

    Select distinct (order number) from the product sales table.

    where Sell Order No. ="' & "Bill number") &'"

    Order by Sales Order Number DESC

    sq1, cn, adopenkeyset, adlockoptimistic

  2. Anonymous users2024-02-06

    select * from Product Sell Table where Sell Order Number in'"(Select Distinct(Sell Order Number) from Product Sales Sheet Order by Sell Order by Sell Order Number DESC)."'"

  3. Anonymous users2024-02-05

    select distinct(Sell Order Number), B,C,D from Product Sell Sheet Order by Sell Note Number Desc

    b, c, d are all the fields in the product sales table.

  4. Anonymous users2024-02-04

    It's simple: sq2 ="select * from Product Sell Form where Sell Order in (Select distinct( Sell Note Number ) from Product Sell Form Order by Sell Note Desc)."

    sq2, cn, adopenkeyset, adlockoptimistic

  5. Anonymous users2024-02-03

    If in the same database.

    sq1 = "Select * from Product Sell Form Order by Sell Order Number DESC"

    Can. If the database is different.

    You have a problem with your programming language.

    To make a loop.

  6. Anonymous users2024-02-02

    Your two tables are the same, huh?

  7. Anonymous users2024-02-01

    1.Start by double-clicking to open the database.

    2.Click on the head navigation: Create--> Query Design-->Close the pop-up window-->Click "SQL" on the left side -- perform SQL commands.

    3.First, query the data of the entire table. Enter the SQL statement: select * from news.

    After entering the SQL statement, click the red "! " to execute the statement.

    You'll find that all the data in the table is queried out.

    4.If you only want to query the "title" field in the news table as "SQL statement use", then how to write it, then you need to use the SQL statement conditional statement, that is, the where statement.

    Enter the statement select * from news where title='Use of SQL statements'

    In this way, the data with the title "Use of SQL statements" comes out.

    where title='Use of SQL statements'The single quotation marks must be in single quotation marks in English, not in Chinese, remember! )。

    5.If you want to query only the first two data items in the news table.

    Enter the statement select top 2 * from news.

    In this way, the first 2 pieces of data will be queried.

    6.Proficient use of SQL statements can easily and quickly operate the database, effectively improving work efficiency.

  8. Anonymous users2024-01-31

    That is to say, if you use subqueries, you should generally use the in method, and it is better not to use the equal method.

    For example, there are two tables as follows:

    Class Table, Student Table.

    Now it's time to check all the information in the student sheet for all students who are in a class of one year.

    Then the available SQL statements are as follows:

    select * from student table where class id in (select class id from class table where class name=.)'Classes are held once a year');

    If you change in to =, then an error will be reported, and the error content is "nested query subqueries can return a maximum of one record".

  9. Anonymous users2024-01-30

    where course number = (select course number from course where credits=3).

    Change to where course code in (select course code from course where credit=3);

Related questions
8 answers2024-04-15

Write :

like "*1*" and like "*2*" and like "*3*" >>>More

8 answers2024-04-15

The if statement is still very fast to execute, and it doesn't need to be optimized.

3 answers2024-04-15

Well, with ADO, you can directly select and output to excel, for example, insert into [excel; database='c:\''sheet1$''(Field 1, Field 2,...)from .. >>>More

13 answers2024-04-15

For example, the name of your table is a

select a.Name, aGrades as Language, BGrades as Mathematics. >>>More

4 answers2024-04-15

select

from[Table name]. >>>More