[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Multiple results on one line

schaapiee

3/21/2007 1:30:00 PM

I have a 'Number' which has multiple descriptions, and I want them to
return on the same line in multiple columns instead of returning
duplicate records. The info in all the other columns is identical.
There is a number tied to the Desc items; so if you were to say Where
Desc1 = 1 it would only return Blah Blah1.

Here is my example:

Number Desc1

1234 Blah Blah1
1234 Blah Blah2

I want it to show, how can I do this?

Number Desc1 Desc2

1234 Blah Blah1 Blah Blah2

I have written a case structure that returns the following instead,
which I dont want

Number Desc1 Desc2

1234 Blah Blah1 NULL
1234 NULL Blah Blah2

6 Answers

xyb

3/21/2007 1:36:00 PM

0

On 3?21?, ??9?29?, "schaapiee" <drobertmil...@yahoo.com> wrote:
> I have a 'Number' which has multiple descriptions, and I want them to
> return on the same line in multiple columns instead of returning
> duplicate records. The info in all the other columns is identical.
> There is a number tied to the Desc items; so if you were to say Where
> Desc1 = 1 it would only return Blah Blah1.
>
> Here is my example:
>
> Number Desc1
>
> 1234 Blah Blah1
> 1234 Blah Blah2
>
> I want it to show, how can I do this?
>
> Number Desc1 Desc2
>
> 1234 Blah Blah1 Blah Blah2
>
> I have written a case structure that returns the following instead,
> which I dont want
>
> Number Desc1 Desc2
>
> 1234 Blah Blah1 NULL
> 1234 NULL Blah Blah2

use
max()
and
group by

Uri Dimant

3/21/2007 2:06:00 PM

0

Hi
create table #t (Number int,Desc1 varchar(50))

insert into #t values (1234,'Blah Blah1')

insert into #t values (1234,'Blah Blah2')



select number, max(case when Desc1='Blah Blah1' then Desc1 end) as Desc1,

max(case when Desc1='Blah Blah1' then Desc1 end) as Desc2

from #t group by number





"schaapiee" <drobertmiller@yahoo.com> wrote in message
news:1174483769.989926.107790@e65g2000hsc.googlegroups.com...
>I have a 'Number' which has multiple descriptions, and I want them to
> return on the same line in multiple columns instead of returning
> duplicate records. The info in all the other columns is identical.
> There is a number tied to the Desc items; so if you were to say Where
> Desc1 = 1 it would only return Blah Blah1.
>
> Here is my example:
>
> Number Desc1
>
> 1234 Blah Blah1
> 1234 Blah Blah2
>
> I want it to show, how can I do this?
>
> Number Desc1 Desc2
>
> 1234 Blah Blah1 Blah Blah2
>
> I have written a case structure that returns the following instead,
> which I dont want
>
> Number Desc1 Desc2
>
> 1234 Blah Blah1 NULL
> 1234 NULL Blah Blah2
>


Mulligan

3/5/2014 10:44:00 PM

0


On Wednesday, March 5, 2014 5:40:24 PM UTC-5, SAW wrote:
> On Wednesday, March 5, 2014 5:38:20 PM UTC-5, SAW wrote:
>
> > On Wednesday, March 5, 2014 5:33:11 PM UTC-5, SAW wrote:
>
> >
>
> > > http://en.wikipedia.org/wiki/2009_Russia%E2%80%93Ukraine_g...
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > The 2009 Russia–Ukraine gas dispute was a pricing dispute between Russia and Ukraine that occurred when Russian natural gas company Gazprom refused to conclude a supply contract for 2009 unless Ukrainian gas company Naftogaz paid its accumulating debts for previous gas supplies.[1] The dispute began in 2008 with a series of failed negotiations, and on January 1 Russia cut off gas supplies to Ukraine.[2] On January 7 the dispute turned to crisis when all Russian gas flows through Ukraine were halted for 13 days, completely cutting off supplies to Southeastern Europe, most of which depends on Russian gas, and partially to other European countries
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > On January 4, two days after gas supplies to Europe were first reported to be falling,[22] the Czech EU Presidency, on behalf of the EU, made a statement calling for an "urgent solution" to the dispute, and for an "immediate resumption" of full deliveries of gas to the EU member states. According to the statement, "energy relations between the EU and its neighbours should be based on reliability and predictability
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > On January 7, all Russian gas flow through Ukraine was halted, completely cutting off supplies to Southeastern Europe, much of which is completely reliant on Russian gas, and partially to other parts of Europe
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > On January 7, after Russian gas deliveries to Europe through Ukraine were completely halted, German Chancellor Angela Merkel phoned both the Russian and Ukrainian Prime Ministers and reached an agreement with them that "experts from the European gas industry and the EU be sent quickly to determine on both sides of the Russia–Ukraine border..the cause of the transmission problems". For the next 4–5 days the commission focused on coming up with terms of reference for an agreement to be signed by all parties
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Although international monitors had been deployed, it became clear by the next day that they would have nothing to monitor, as mutual accusations between Russia and Ukraine over who was responsible for blocking gas flow continued
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > On January 17, Russia held an international gas conference in Moscow, inviting the heads of states and governments of all countries buying or transporting Russian gas. The proposal was met with little enthusiasm, but the EU stated that it would attend under the precondition that Ukraine's participation was ensured.[54] Ukraine agreed and was represented by Prime Minister Tymoshenko, who was given full mandate at the talks.[55] The EU was represented by the Czech Minister of Industry and Trade Martin Ríman and the EU Energy Commissioner Andris Piebalgs.[54]
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > The summit did not achieve a solution to the crisis, but negotiations continued bilaterally between prime ministers Putin and Tymoshenko afterwards
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > On January 2, a day after Russia cut off gas supplies to Ukraine, Hungary, Romania and Poland were the first countries to report that pressure in their pipelines had fallen. Bulgaria reported that their supply was also falling and that transit to Turkey, Greece and Macedonia was affected.[22] Two days later the Czech Republic and Turkey reported drops in pipeline pressure.[26] Starting on January 7, several countries began to report a significant drop in gas supplies from Russia. Throughout the crisis many countries were unprepared and had been left without supplies for days, leading to significant economic and humanitarian consequences; Bulgaria was forced to stop production in some of its important industrial plants, while one country, Slovakia, declared a state of emergency.[63] The most severely effected countries were in Southeastern Europe, most of which rely completely on Russia for gas and at the time didn't have sufficient alternative energy sources.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > In April 2011 a criminal case against former Ukrainian Prime Minister Yulia Tymoshenko was brought in connection with alleged abuse of power during the dispute.[90][91] Tymoshenko was sentenced to seven years in prison by a Ukrainian court in October 2011.[5] Tymoshenko has labelled the case as "absurd
>
> >
>
> >
>
> >
>
> > http://www.cbsnews.com/news/does-russian-oil-trump-possible-european-...
>
> >
>
> >
>
> >
>
> > In the geopolitical poker game currently underway in Ukraine, Russia appears to be holding some strong cards, using its control over much of Western Europe's energy supplies as a deterrent to any European Union actions against Moscow's de facto occupation of Crimea.
>
> >
>
> >
>
> >
>
> > According to the European Commission, over 54 percent of the EU's total regional energy consumption in 2010 was imported from outside the EU. And a large percentage of that imported energy, including about one-fourth of the oil and gas used in Europe, originates in Russia. In 2010, 34.5 percent of the EU's imports of crude oil came from Russia, "whose disputes with transit countries have threatened to disrupt supplies in recent years," according to the EU's eurostat website.
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > A large portion of Russian oil bound for Western Europe passes through Ukraine. And twice in the past decade, in 2006 and 2009, Russia has turned off natural gas shipments to Ukraine during disputes over gas prices. That in turn created shortages in some EU member nations
>
> >
>
> >
>
> >
>
> > A report from the Capital Economics research group notes that Russia is a major supplier of oil to Germany and the Netherlands in particular "and of natural gas to Western Europe generally
>
>
>
> http://en.wikipedia.org/wiki/Oil_reserves...
>
>
>
> By 2011, Russian oil production had increased to 10,540,000 bbl/day.[7] It is the largest producer and exporter of oil in the world

http://en.wikipedia.org/wiki/Petroleum_industry...

The petroleum industry in Russia is one of the largest in the world. Russia has the largest reserves, and is the largest exporter, of natural gas. It has the second largest coal reserves, the eighth largest oil reserves, and is the largest producer of oil.[2] It is the third largest energy user.[3]

Russia is the largest oil producer in the world, producing an average of 10..2 million barrels (1,620,000 m3) of oil per day in 2010.[2] It produces 12% of the world's oil and has a same share in global oil exports.[4] In June 2006, Russian crude oil and condensate production reached to the post-Soviet maximum of 9.7 million barrels (1,540,000 m3) per day. Exceeding production in 2000 by 3.2 Mbbl/d (510,000 m3/d). Russian export consists more than 5 Mbbl/d (790,000 m3/d) of oil and nearly 2 Mbbl/d (320,000 m3/d) of refined products, which go mainly to the Europe market

Mulligan

3/5/2014 10:49:00 PM

0

On Wednesday, March 5, 2014 5:46:06 PM UTC-5, SAW wrote:
> http://www.reuters.com/article/2014/03/03/markets-oil-idUSL3N0M00...

http://www.reuters.com/article/2014/02/28/us-cuba-russia-ship-idUSBREA1Q2...

Reuters) - A Russian spy ship slipped into Havana Bay for an unannounced visit during a period of turmoil in Ukraine and displays of military strength elsewhere in the world.

The Viktor Leonov SSV-175, part of the Vishnya class of intelligence ships, quietly entered Cuban waters earlier this week and was docked at a cruise ship terminal on Thursday, its crew casually taking in the view of the old colonial section of the Cuban capital as passers-by gawked.

Russian warships have come and gone in Cuba since the collapse of the Soviet Union, usually with much publicity and the opportunity for Cubans to visit the ship. This time there was no mention in the Cuban state-run media

Russia has been stung by recent unrest in Ukraine, where a pro-Russian government was ousted in favor of one seeking an alliance with the West, and where Russia has a major naval base near Sevastopol on the Black Sea.

Russia on Wednesday put 150,000 troops on high alert in Central and Western Russia, including areas bordering Ukraine, in a show of strength. Moscow denied the drill was linked to events in Ukraine.

On Wednesday in Moscow, Defense Minister Sergei Shoigu said Russia planned to increase its military projection abroad, including in Cuba, Venezuela and Nicaragua.

The Russian Navy intelligence vessel in Havana was commissioned by the Soviet Union in 1988 near the end of the Cold War, outfitted with electronic surveillance equipment and missile defense systems and is a signals intelligence asset of the Russian Navy, according to the Russian government.


The 94-meter (309-foot) ship was receiving food, but no maintenance or fuel, port employees said.

A Russian embassy official described the visit as "friendly," saying members of the crew joined Havana officials in laying a wreath at a monument to Soviet soldiers.

"It was scheduled to stay three or four days. It should leave tomorrow," said the embassy spokesman, who declined to identify himself.

The former Soviet Union and communist-run Cuba were close allies for decades, and the Soviets built a major intelligence base on the outskirts of Havana that was closed soon after the demise of European communism.

During the recent Winter Olympics in Sochi, Russia, two U.S. ships including the USS Mount Whitney sailed into the Black Sea as part of U.S. security measures

Just Wondering

3/5/2014 11:09:00 PM

0