SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    555
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Get specific cols. only from the tables

    Hi,

    I have this following query which works, but i need it to return only the cols. I am asking it to. But its returning all cols in the table. How to get only cols that i am renaming in the query i.e only 5 cols.

    Code:
    SELECT stocks.*, devbg_products.*,
    	stoc_id AS SKU,
    	ItemName as ItemTitle,
    	stoc_qty AS AvailableQuantity,
    	ItemPrice AS RetailPrice,
    	ItemDescription AS Description
    FROM stocks 
    	LEFT JOIN devbg_products ON stocks.stoc_item_id = devbg_products.ItemID;
    Please help.

    Thanks.

  2. #2
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    555
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Sorry my bad, I did the following and its working:

    Code:
    SELECT 
    	stocks.stoc_id AS SKU, 
    	devbg_products.ItemName as ItemTitle,
    	stocks.stoc_qty AS AvailableQuantity,
    	devbg_products.ItemPrice AS RetailPrice,
    	devbg_products.ItemDescription AS Description
    FROM stocks 
    	LEFT JOIN devbg_products ON stocks.stoc_item_id = devbg_products.ItemID
    Thanks.

  3. #3
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,195
    Mentioned
    71 Post(s)
    Tagged
    3 Thread(s)
    You need to change this:
    Code:
    stocks.*, devbg_products.*,
    To something like:
    Code:
    stocks.items, stocks.prices, devbg_products.colour, devbg_products.pattern, stoc_id


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
  •