Solved

My SQL Query, append text to a result and add new default results??

Posted on 2009-06-27
7
389 Views
Last Modified: 2012-05-07
Hi,
I have this query( in code box):

The line:
xcart_products.productid AS link
I actually need to add 'http://www.mydomain.com/product.php?id=' before to returned number.

I also need to add an extra colum with todays date automatically added??

I would normally add these on the page but this is being exported directly form Navicat to an CSV file.

Help!!!!!!!!!
Tony


SELECT

xcart_products.productcode AS id,

xcart_products.product AS title,

xcart_products.list_price*1.15 AS price,

xcart_products.descr AS description,

xcart_products.avail AS quantity,

xcart_products.forsale,

xcart_products.weight AS weight,

xcart_categories.category AS product_type,

xcart_manufacturers.manufacturer AS brand,

xcart_quick_flags.image_path_T AS image_link,

xcart_products.productid AS link

FROM

xcart_products

Inner Join xcart_products_categories ON xcart_products_categories.productid = xcart_products.productid

Inner Join xcart_categories ON xcart_categories.categoryid = xcart_products_categories.categoryid

Inner Join xcart_manufacturers ON xcart_manufacturers.manufacturerid = xcart_products.manufacturerid

Inner Join xcart_quick_flags ON xcart_quick_flags.productid = xcart_products.productid

Open in new window

0
Comment
Question by:tonypearce
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
Comment Utility
you can surely use concat function:

select concat( 'http://www.mydomain.com/product.php?id=' ,FIELDNAME) as aliasfieldname .....
0
 

Author Comment

by:tonypearce
Comment Utility
that works great, thanks, any idea how to add a new column result with a default value??
Tony
0
 
LVL 21

Expert Comment

by:theGhost_k8
Comment Utility
couldn't get the question:
Do u mean adding  to table?
ALTER TABLE tablename MODIFY colNAME <DATATYPE> DEFAULT <VALUE>;
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:tonypearce
Comment Utility
Sorry, I'm not being clear...

I am producing a froogle feed from Navicat, unfortunatly the database does not have all the fields required, so when running the query I need to output extra results set to a default value...
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
Comment Utility
well you can directly select required values...

select "string value" as columnname .....
0
 

Author Comment

by:tonypearce
Comment Utility
Thats it,

Thanks so much.......
0
 

Author Closing Comment

by:tonypearce
Comment Utility
Thanks so much.....
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now