- SELECT ARTWORK.TITLE AS 'Title',ARTWORK.DATE_LISTED AS 'Date Listed',
-
ARTWORK.USUAL_TYPE as 'Type',ARTWORK.USUAL_MEDIUM as 'Medium', ARTWORK.USUAL_STYLE as 'Style',
-
ARTWORK.YEAR_COMPLETED as 'Year',ARTWORK_SALES.ASKING_PRICE as 'Asking Price'
-
-
FROM ARTWORK_SALES,ARTWORK_SOLD
-
-
INNER JOIN ARTWORK ON ARTWORK.ARTWORK_CODE=ARTWORK.ARTWORK_CODE
-
GROUP BY TITLE, ARTWORK.TITLE,ARTWORK.DATE_LISTED,ARTWORK.USUAL_TYPE,ARTWORK.USUAL_MEDIUM,ARTWORK.USUAL_STYLE,
-
ARTWORK.YEAR_COMPLETED,ARTWORK_SALES.ASKING_PRICE
That is my code and i get the correct result but they repeat each row
17 2825
Please Post your sample result for this Query
Love lost 2011-07-12 00:00:00.000 Painting Oil Contempory 2011-05-15 00:00:00.000 15000.00
Love lost 2011-07-12 00:00:00.000 Painting Oil Contempory 2011-05-15 00:00:00.000 150000.00
My Queen 2011-10-10 00:00:00.000 Sculpture Mixed Folk 2009-08-17 00:00:00.000 15000.00
My Queen 2011-10-10 00:00:00.000 Sculpture Mixed Folk 2009-08-17 00:00:00.000 150000.00
Reality 2011-08-17 00:00:00.000 Sculpture Marble Impressionist 2010-05-28 00:00:00.000 15000.00
Reality 2011-08-17 00:00:00.000 Sculpture Marble Impressionist 2010-05-28 00:00:00.000 150000.00
use distinct keyword after select keyword in Sql Query
Example: Select distinct form tablename
oh Sorry i cant see Correctly.
What you Actually want to Display in "Asking Price" Field
The problem is with the field name "Asking Price". Because it Contain 15000.00 in first row then 150000.00 in Second Row. So group by cannot Work here.
So What You want to Display in this Field Actually?
Oh ok..Il see how i solve this one.
What is the Common Field for ARTWORK_SALES and ARTWORK Tables.
The common field is artwork_code
but why you check like this in inner join condition
ARTWORK.ARTWORK_CODE=ARTWORK.ARTWORK_CODE
Change this like
ARTWORK.ARTWORK_CODE=ARTWORK_SALES.ARTWORK_CODE.
You need to Sum the "Asking Price" in ARTWORK_SALES by ARTWORK_CODE Right?
Inner join artwork on artwork.artwork_code=artwork_sold.artwork_code
i have used this code and now it repeats twice and not for times
ok Ntshoekeleng. Please Say What You need to Display in "Asking Price" field?
15000.00 or 150000.00 or Sum of this two Values(From Your Result).
The sum of the two values
So You need to Change the Query. Please Remove "Asking Price" from Group by and put Sum(ARTWORK_SALES.ASKING_PRICE) in Select Query. Please find this Link http://w3schools.com/sql/sql_func_sum.asp . Its help You To know about Sum() function in Sql.
- SELECT distinct ARTWORK.TITLE AS 'Title',ARTWORK.DATE_LISTED AS 'Date Listed',
-
ARTWORK.USUAL_TYPE as 'Type',ARTWORK.USUAL_MEDIUM as 'Medium', ARTWORK.USUAL_STYLE as 'Style',
-
ARTWORK.YEAR_COMPLETED as 'Year',ARTWORK_SALES.ASKING_PRICE as 'Asking Price'
-
-
FROM ARTWORK_SALES,ARTWORK_SOLD
-
-
INNER JOIN ARTWORK ON ARTWORK.ARTWORK_CODE=ARTWORK.ARTWORK_CODE
-
GROUP BY TITLE, ARTWORK.TITLE,ARTWORK.DATE_LISTED,ARTWORK.USUAL_TY PE,ARTWORK.USUAL_MEDIUM,ARTWORK.USUAL_STYLE,
-
ARTWORK.YEAR_COMPLETED,ARTWORK_SALES.ASKING_PRICE
try this after ask me
sonurathore, please see the Result of the Query -
Love lost 2011-07-12 00:00:00.000 Painting Oil Contempory 2011-05-15 00:00:00.000 15000.00
-
Love lost 2011-07-12 00:00:00.000 Painting Oil Contempory 2011-05-15 00:00:00.000 150000.00
-
Distinct is not Work here.
Aren't you trying to SUM up the field? I don't see SUM anywhere in your code.
Also, please use code tags when posting code.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Wescotte |
last post by:
Here is a small sample program I wrote in PHP (running off Apache
1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data
base is using DB2 V5R3M0. The client is WinXP machine using...
|
by: Joseph |
last post by:
I have a textBox that people writes stories in it. They can use
for format.
I have Aspell installed on the server, so people can make correction to
their text. Sometimes, they forget to add a...
|
by: MLH |
last post by:
Am repeating question with different subject heading, perhaps
stating more clearly my problem...
I have an A97 query (qryVehiclesNowners2) that has a table
field in it named . Depending on the...
|
by: MLH |
last post by:
I have a table (tblCorrespondence) holding records with fields like
, , , , , ,
, etc...
About a dozen 's are defined and I often use queries to
extract records of a given . That's pretty easy....
|
by: guitarromantic |
last post by:
Hey everyone.
I'm editing some stuff I did last summer, trying to bugfix and improve
stuff. One improvement (or an oversight of the original design) is
adding dynamic <title> tags to my pages....
|
by: sbatschelet |
last post by:
I am running into a really odd problem with Access and looking for some
insight as to what could be causing my issue. Basically this SQL
creates a listing of Total Sales (Sum(InvLine.Retail)) by...
|
by: vssp |
last post by:
Hi friends
Thanks for your repaly for all my question..
I need one update query. I have selected the datas are insert with coma ",".
Query
SELECT city
FROM `locations`
WHERE city REGEXP ','
|
by: monomaniac21 |
last post by:
hi all
On a networking site i am working on each user has their own id and the
id of another person who they are linked to. what i want to do is to be
able to pull up a list of everyone linked...
|
by: CJM |
last post by:
I have a fairly simple ASP application talking to an Oracle 10g DB using a
mixture of ADO (OraOLEDB) and OO4O - the query here concerns some ADO code.
One part of the application records...
|
by: aaronkm |
last post by:
Hello thescripts and well met.
I've recently been handed a new duty and have the joy of 'crash coursing' MS Access.
Things are working well but I've ran into a problem that I can't seem to find...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |