dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

QUERY WRITING - Database Discussions

This is a discussion on QUERY WRITING - Database Discussions ; Segun wrote: > Hi all, > I have a table with data as shown below > > PRODUCT ENGLAND USA FRANCE IRELAND > Orange 100 101 100 90 > Mango 110 110 110 80 > Pawpaw 100 120 112 100 ...


Home > Database Forum > Database and Unix Discussions > Database Discussions > QUERY WRITING

Reply

 

LinkBack Thread Tools Display Modes
  #31  
Old 11-29-2004, 02:22 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Segun wrote:

> Hi all,
> I have a table with data as shown below
>
> PRODUCT ENGLAND USA FRANCE IRELAND
> Orange 100 101 100 90
> Mango 110 110 110 80
> Pawpaw 100 120 112 100
> Grape 105 130 124 115
> Banana 115 140 100 150
>
> Can someone please help generate a code to produce an output as shown below
>
> PRODUCT QUANTITY
> Orange 391
> Mango 410
> Pawpaw 432
> Grape 474
> Banana 505
>
> Thanks all, while expecting the reply urgently.
>
> Olu


Your problem is that your data is nor normalized.
Normalize the data by restructuring the table and
then write your own query.

In short ... we don't do other people's homework
for them.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)
Reply With Quote
  #32  
Old 11-29-2004, 02:30 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Mladen Gogala wrote in message news:...
> of course: TRUNCATE TABLE will give you the expected results.
> If your table is called MYTABLE you should execute the following:
> TRUNCATE TABLE MYTABLE;
> AS SELECT PRODUCT, ENGLANd+GERMANY+FRANCE+USA
> /
>
> Don't forget the semicolon at the end of the 1st line or the
> statement will not work. You don't have to thank me.


Man, that's harsh...
Reply With Quote
  #33  
Old 11-29-2004, 02:30 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Mladen Gogala wrote in message news:...
> of course: TRUNCATE TABLE will give you the expected results.
> If your table is called MYTABLE you should execute the following:
> TRUNCATE TABLE MYTABLE;
> AS SELECT PRODUCT, ENGLANd+GERMANY+FRANCE+USA
> /
>
> Don't forget the semicolon at the end of the 1st line or the
> statement will not work. You don't have to thank me.


Man, that's harsh...
Reply With Quote
  #34  
Old 11-29-2004, 02:30 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Mladen Gogala wrote in message news:...
> of course: TRUNCATE TABLE will give you the expected results.
> If your table is called MYTABLE you should execute the following:
> TRUNCATE TABLE MYTABLE;
> AS SELECT PRODUCT, ENGLANd+GERMANY+FRANCE+USA
> /
>
> Don't forget the semicolon at the end of the 1st line or the
> statement will not work. You don't have to thank me.


Man, that's harsh...
Reply With Quote
  #35  
Old 11-29-2004, 02:30 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Mladen Gogala wrote in message news:...
> of course: TRUNCATE TABLE will give you the expected results.
> If your table is called MYTABLE you should execute the following:
> TRUNCATE TABLE MYTABLE;
> AS SELECT PRODUCT, ENGLANd+GERMANY+FRANCE+USA
> /
>
> Don't forget the semicolon at the end of the 1st line or the
> statement will not work. You don't have to thank me.


Man, that's harsh...
Reply With Quote
  #36  
Old 11-29-2004, 02:30 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Mladen Gogala wrote in message news:...
> of course: TRUNCATE TABLE will give you the expected results.
> If your table is called MYTABLE you should execute the following:
> TRUNCATE TABLE MYTABLE;
> AS SELECT PRODUCT, ENGLANd+GERMANY+FRANCE+USA
> /
>
> Don't forget the semicolon at the end of the 1st line or the
> statement will not work. You don't have to thank me.


Man, that's harsh...
Reply With Quote
  #37  
Old 11-29-2004, 02:30 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: QUERY WRITING

Mladen Gogala wrote in message news:...
> of course: TRUNCATE TABLE will give you the expected results.
> If your table is called MYTABLE you should execute the following:
> TRUNCATE TABLE MYTABLE;
> AS SELECT PRODUCT, ENGLANd+GERMANY+FRANCE+USA
> /
>
> Don't forget the semicolon at the end of the 1st line or the
> statement will not work. You don't have to thank me.


Man, that's harsh...
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 12:46 PM.