Results 1 to 2 of 2

Thread: query problem

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    query problem

    I have the table ventypecat which has the VenCatId values (int):

    VenId VenTypeId VenCatId
    28------ 1------ 16
    28------ 2------ 20

    In my query I have to output VenCatId values WHERE they are VenTypeId=1 AS Distributors
    and WHERE they are VenTypeId=2 AS Service
    But I have no Idea how can I achieve this in the same query:



    Code:
    SELECT vendors.*, group_concat( DISTINCT countries.CtryNam ) AS Country, group_concat( DISTINCT ventypecat.VenCatId ) AS Distributor
    FROM vendors, countries, ventypecat
    WHERE vendors.VenId = ventypecat.VenId AND vendors.CtryId = countries.CtryId AND ventypecat.VenTypeId =1
    GROUP  BY vendors.VenNam
    As you can see now I'm outputing just VenCatId WHERE ventypecat.VenTypeId =1, but I need both in separated colums.

    Thanks for ALL your help !!

  2. #2
    Join Date
    Dec 2005
    Posts
    11
    can u post the table structure and the data so we can try to simulate ur problem and find a solution

    thanks

Posting Permissions

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