in Education by
I'm using the Microsoft Access to do the SQL and is there any way for me to set the criteria for the Functions such as COUNT? I found that the COUNT() Function will count the records where the Captain field meets the requirement too where Pilots.[PilotNum] = Bookings.[Co-Captain] AND Pilots.[PilotNum] = Bookings.[Captain] The SQL below is the SQL I used to find the number of the Co-captain for each Pilots The result of my SQL HOW can I use COUNT() function to count each PilotNum appeared in each column seperately JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Instead of count() I think it would be easier to use sum(), like this: Select Pilots.PilotNum , Sum(Iif(Bookings.[Co-Captain]=Pilots.PilotNum,1,0)) As CoCapt , Sum(Iif(Bookings.[Captain]=Pilots.PilotNum,1,0)) As Capt From... The ... just means the rest is the same as you wrote it. The key point here is to use the Iif() function to establish a one or zero value and then just sum them up.

Related questions

0 votes
    I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the ... of the management studio.) Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    Could anybody tell me where I can learn Microsoft SQL Server? Select the correct answer from above options...
asked Jan 6, 2022 in Education by JackTerrance
0 votes
    I have seen SQL that uses both != and for not equal. What is the preferred syntax and why? I like !=, ... reminds me of Visual Basic. Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    Could someone tell me what I should learn to become a SQL Developer? Select the correct answer from above options...
asked Jan 6, 2022 in Education by JackTerrance
0 votes
    How do I perform an IF...THEN in an SQL SELECT statement? For example: SELECT IF(Obsolete = 'N' OR ... Saleable, * FROM Product Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    In SQL Server, it's possible to insert into a table using a SELECT statement: INSERT INTO Table (col1, col2, ... .id = other_table.id Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me how do I view all tables in SQL? Select the correct answer from above options...
asked Jan 18, 2022 in Education by JackTerrance
0 votes
    I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of ... WHERE ... Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have not used access before but I have to convert an access query into SQL so I can write a report in crystal ... like this in SQL? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of ... WHERE ... Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I have not used access before but I have to convert an access query into SQL so I can write a report in crystal ... like this in SQL? Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what kind of job can you get with a SQL certification? Select the correct answer from above options...
asked Jan 9, 2022 in Education by JackTerrance
0 votes
    I would like to ask for performance of SQL. This is my query: Select A.code ,A.name ,(Select B. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what are the requirements for SQL Developer? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I have a SQL column with a length of 6. Now want to take only the first char of that column. Is there any ... in SQL to do this? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
...