Statement to return one column ony

  • SELECT COUNT(*) AS Records

    FROM Members

    WHERE (CourseCode = @CourseCode) AND (CourseSession = @CourseSession)

  • What is the problem here?

  • The query displays all 8 cloumns in my table. I just want to display the "Records" column only.

  • you've show us just part of your stored procedure, it looks like...the line you posted wil certainly only display a single column, "Records", so there must be a line in your stored proc AFTER the line you have shown us that is selecting more.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Well, from the code you gave it is impossible to get 8 columns. if it is right code then you will get the number of records into record column. U r missing something.

  • Yes, you are correct. It returns one column after creating a separate tableadaptor for the query.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply