Results 1 to 6 of 6

Thread: Select All Document IDs in a DataBase

  1. #1
    Join Date
    Nov 2013
    Posts
    8

    Select All Document IDs in a DataBase

    Hi all!

    I am new here. I am also new to SQL. Here's what I am trying to accomplish:

    Select all (unique) document IDs in a given database. I'd like to have them display. Here is one of the queries for what I've done thus far:

    SELECT docid
    FROM data_base
    WHERE docid > '0';

    Which returns only the column "docid". I was hoping for the actual numbers, not merely the column.

    What am I doing wrong?

    Thank you in advance!

    keega

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Is it for sql server? Do you know table schema?

  3. #3
    Join Date
    Nov 2013
    Posts
    8
    It is for SQL Server. Not sure of the table schema...second day doing SQL I was able to extract the info I needed, however. I'd post what I did, but it's soooo basic, you all probably already know this.

  4. #4
    Join Date
    Nov 2013
    Posts
    8
    But thank you rmiao, knowing you guys/gals are here makes me feel pretty comfortable!

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    This will give you a list of docid and count for each

    SELECT docid, count(*)
    FROM data_base
    group by docid

  6. #6
    Join Date
    Nov 2013
    Posts
    8

    Cool

    Thank you skhanal!

    Quote Originally Posted by skhanal View Post
    This will give you a list of docid and count for each

    SELECT docid, count(*)
    FROM data_base
    group by docid

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •