Professional Web Applications Themes

newbie: "complex" query - MySQL

Hi all, I've a problem writing a VB 2005 application that interacts with a mysql database that stores the correspondence with our customers. I hope you can understand me since I'm italian. I've got two tables: the first one is called CORRESPONDENCE and is similar to this: id subject cathegory -------------------------------- 1 bla bla bla 1 2 bla123 1 3 bla1 bla2 bla3 2 4 123blabla 1 .... ... ... the second one is called CATHEGORIES: id description -------------------- 1 italy customers 2 france customers 3 uk customers .... ... So as you can se the "cathegory" column of the ...

  1. #1

    Default newbie: "complex" query

    Hi all,
    I've a problem writing a VB 2005 application that interacts with a mysql
    database that stores the correspondence with our customers.
    I hope you can understand me since I'm italian.

    I've got two tables:
    the first one is called CORRESPONDENCE and is similar to this:

    id subject cathegory
    --------------------------------
    1 bla bla bla 1
    2 bla123 1
    3 bla1 bla2 bla3 2
    4 123blabla 1
    .... ... ...

    the second one is called CATHEGORIES:

    id description
    --------------------
    1 italy customers
    2 france customers
    3 uk customers
    .... ...

    So as you can se the "cathegory" column of the first tables simply
    indicates the cathegory which a letter belongs to (italian customers,
    french customers and so on)

    Now I want to build a query that simply list all the stored letters,
    showing the description of their cathegory, not only its id.

    the outpuk should look like this:
    1 bla bla bla italy customers
    2 bla123 italy customers
    3 bla1 bla2 bla3 france customers
    4 123blabla italy customers
    ....

    This work should be done with a single query, without using subroutines
    or subqueries. I would use something like:
    "SELECT id, subject, cathegory FROM correspondence ORDER BY id
    AND id, description FORM cathegories WHERE
    cathegories.id=correspondence.cathegory"

    But of course I dont't know the correct syntax, supposing of course this
    could be possibile! :-)

    thanks in advance
    m.

    Ministry Guest

  2. #2

    Default Re: newbie: "complex" query

    Ministry ha scritto:
    > Hi all,
    > I've a problem writing a VB 2005 application that interacts with a mysql
    > database that stores the correspondence with our customers.
    > I hope you can understand me since I'm italian.
    > [snip...]
    Ok, I seem to have solved it using the JOIN feature.
    Thanks anyway
    m.
    Ministry Guest

Similar Threads

  1. ColdFusion+cfquery+Oracle+CLOB+"Query of Query"
    By ferse in forum Coldfusion Database Access
    Replies: 0
    Last Post: April 25th, 01:28 PM
  2. cfgrid inside a <cfoutput query="myQuery" group="GROUP">
    By DavidGhous in forum Coldfusion Flash Integration
    Replies: 1
    Last Post: April 12th, 07:23 PM
  3. "Complex" data types like BYTEA in embedded SQL with ecpg
    By Hans-Michael Stahl in forum PostgreSQL / PGSQL
    Replies: 0
    Last Post: December 13th, 04:36 PM
  4. SOAP::Lite - serve a complex "object"?
    By J. Patrick Brandt in forum PERL Miscellaneous
    Replies: 0
    Last Post: September 2nd, 05:45 PM
  5. "Start" "Program" "Menu" list is empty
    By Pete in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 10th, 10:42 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139