Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137

    Unanswered: Special Query Construction

    I have a query that I am building, that I am having a tough time getting a handle on. What I have are tables like the following:

    CREATE TABLE fv (
    vectorid INT UNSIGNED NOT NULL AUTO_INCREMENT,
    dimension INT UNSIGNED NOT NULL,
    value FLOAT NOT NULL,
    PRIMARY KEY(dimension, vectorid)
    );

    CREATE TABLE centers (
    centerid INT UNSIGNED NOT NULL AUTO_INCREMENT,
    dimension INT UNSIGNED NOT NULL,
    value FLOAT NOT NULL,
    PRIMARY KEY(dimension, centerid)
    );

    CREATE TABLE selected (
    selectid INT UNSIGNED NOT NULL AUTO_INCREMENT,
    centerid INT UNSIGNED NOT NULL,
    PRIMARY KEY (centerid, selectid)
    );

    I want to select records out of the centers table based on the centerid values in the selected table for a specific selectid value. Then I want to join the fv table to the centers table using dimension and a specific number of random vectorid values. To make things a little more difficult, the query should return a single centerid associated with a single vectorid. What would be the best method of attack? I am using Python for the application logic.

  2. #2
    Join Date
    Sep 2002
    Location
    Montreal, Canada
    Posts
    224
    Provided Answers: 1

    Re: Special Query Construction

    Originally posted by aus
    I have a query that I am building, that I am having a tough time getting a handle on. What I have are tables like the following:

    CREATE TABLE fv (
    vectorid INT UNSIGNED NOT NULL AUTO_INCREMENT,
    dimension INT UNSIGNED NOT NULL,
    value FLOAT NOT NULL,
    PRIMARY KEY(dimension, vectorid)
    );

    CREATE TABLE centers (
    centerid INT UNSIGNED NOT NULL AUTO_INCREMENT,
    dimension INT UNSIGNED NOT NULL,
    value FLOAT NOT NULL,
    PRIMARY KEY(dimension, centerid)
    );

    CREATE TABLE selected (
    selectid INT UNSIGNED NOT NULL AUTO_INCREMENT,
    centerid INT UNSIGNED NOT NULL,
    PRIMARY KEY (centerid, selectid)
    );

    I want to select records out of the centers table based on the centerid values in the selected table for a specific selectid value. Then I want to join the fv table to the centers table using dimension and a specific number of random vectorid values. To make things a little more difficult, the query should return a single centerid associated with a single vectorid. What would be the best method of attack? I am using Python for the application logic.
    Your description is not clear. Can you provide us with some data and the expected result?

  3. #3
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137
    Here is a mysqldump file with partial data. The structure of the desired result would be:

    fv.dimension, fv.value + centers.value

    I want results for only two centerids from centers with one result for each dimension. The centerids will be specified in selected, but the two vectorids from fv must be random.
    Attached Files Attached Files

Posting Permissions

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