Thread: Sql Query

Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2006
    Posts
    124
    Plugin Contributions
    0

    Default Sql Query

    I need a query to select this fields

    name of the product
    products_id
    price
    category
    image
    stock
    descripton

  2. #2
    Join Date
    Sep 2007
    Location
    Somewhere in Southern Cal
    Posts
    330
    Plugin Contributions
    0

    Default Re: Sql Query

    Note to sure what you are looking for but this is a basic SQL
    it would look something like this (note this will work only if the fields are in one table, if they're in diffrent tables then let me know.

    select name of the product, products_id, price, category, image, stock, descripton from abc;

    if all the fields are in the same table (this will list all the fields within that table. So if all the fields you listed above are in that field this is the best)then you could do this
    select * from abc; (I gues what I'm saying everything in that table will be listed)

    if you want to have an order then you could do this
    select name of the product, products_id, price, category, image, stock, descripton from abc order by products_id desc;

    nomad

  3. #3
    Join Date
    Feb 2006
    Posts
    124
    Plugin Contributions
    0

    Default Re: Sql Query

    This is to export to excel a file that have this fields from a zen-cart.

    This fields are in the same table?

  4. #4
    Join Date
    Sep 2007
    Location
    Somewhere in Southern Cal
    Posts
    330
    Plugin Contributions
    0

    Default Re: Sql Query

    do you need to create a table in you db
    or
    do you want to view your fields in the db
    nomad

  5. #5
    Join Date
    Feb 2006
    Posts
    124
    Plugin Contributions
    0

    Default Re: Sql Query

    I need to view this fiels to copy to a excel fine.
    So i can integrate in a e-marketplace.

  6. #6
    Join Date
    Sep 2007
    Location
    Somewhere in Southern Cal
    Posts
    330
    Plugin Contributions
    0

    Default Re: Sql Query

    If the fields exist in that table
    then you can do this
    select * from abc;

    abc will be your table name.
    this will list all the fields within that table.
    you can also do an order by which will list all the fields in order.
    it migh look something like this
    select * from abc order by category; (or it could be by name of the product, products_id)

    Where are you going to write this SQL at.
    If you have XAMMP that is were I would write it
    This is only a temp SQL script
    nomad

  7. #7
    Join Date
    Feb 2006
    Posts
    124
    Plugin Contributions
    0

    Default Re: Sql Query

    I have this query

    I think that this will give me part of what i need. But now is give me timout


    SELECT `products`.`products_id`,`products`.`products_image`,`products`.`products_status `, `products_description`.`products_name`, `products_to_categories`.`categories_id`
    FROM products, products_description, products_to_categories

  8. #8
    Join Date
    Aug 2007
    Location
    Tampa FL.
    Posts
    142
    Plugin Contributions
    0

    Default Re: Sql Query

    Hello,

    You can't select products from products:

    HTML Code:
    SELECT products_name, products_description, products_url,  products_id,products_quantity, products_model, products_image,products_price,products_virtual, products_weight,   products_date_added, products_last_modified, products_date_available, products_status, products_tax_class_id,  manufacturers_id,        products_quantity_order_min, products_quantity_order_units,   products_priced_by_attribute,     product_is_free, p.product_is_call, products_quantity_mixed,  product_is_always_free_shipping, products_qty_box_status,  products_quantity_order_max,  products_sort_order,  products_discount_type, products_discount_type_from,
    products_price_sorter FROM  products, product_description
                                  WHERE products_id = ''
    And you have periods in place of comas
    Rich

  9. #9
    Join Date
    Feb 2006
    Posts
    124
    Plugin Contributions
    0

    Default Re: Sql Query

    With your query i get:

    Column 'products_id' in field list is ambiguous


    And i have to ad:

    products_to_categories in the FROM

    like this:

    FROM products, products_description, products_to_categories

  10. #10
    Join Date
    Aug 2007
    Location
    Tampa FL.
    Posts
    142
    Plugin Contributions
    0

    Default Re: Sql Query

    Quote Originally Posted by bebijuteria View Post
    I need a query to select this fields

    name of the product
    products_id
    price
    category
    image
    stock
    descripton
    Iam sorry did not realize you needed product to categories,

    anyway, Column 'products_id' in field list is ambiguous

    this is a problem with MySql and i did not put 2 and 2 together u must place table prior to any duplicate fields to seperate from others.
    Try this it should work for you:
    HTML Code:
    SELECT products.products_id, products_type, products_quantity, products_model, products_image, products_price, products_virtual, products_date_added, products_last_modified, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_ordered, products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute, product_is_free, product_is_call, products_quantity_mixed, product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order, products_discount_type, products_discount_type_from, products_price_sorter, master_categories_id, products_mixed_discount_quantity, metatags_title_status, metatags_products_name_status, metatags_model_status, metatags_price_status, metatags_title_tagline_status, products_michel_cat_no, products_scott_cat_no, products_yvert_cat_no, products_sg_cat_no, products_type_logo, products_type_logo2, products_type_logo3, products_item_no, item_year, item_fault, cancel_country_send, cancel_country_receive, cancel_town_send, cancel_town_receive, item_type, storage_loc, cancel_date_send, logo_id,  products_description.products_id, language_id, products_name, products_description, products_url, products_viewed, products_to_categories.products_id, categories_id
    
    
    FROM products, products_description, products_to_categories

 

 

Similar Threads

  1. Replies: 9
    Last Post: 12 Jul 2023, 12:26 AM
  2. v154 Help with a SQL Query for Query Builder
    By lindasdd in forum Managing Customers and Orders
    Replies: 2
    Last Post: 24 Mar 2016, 01:18 PM
  3. v151 SQL query setup. How do I TEST a query 'off-line'?
    By lewisasding in forum General Questions
    Replies: 3
    Last Post: 8 Mar 2013, 12:24 AM
  4. Replies: 2
    Last Post: 15 Aug 2011, 04:58 AM
  5. SQL Query
    By RobWUK in forum General Questions
    Replies: 4
    Last Post: 27 Sep 2010, 04:56 PM

Posting Permissions

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