How can I get these two results in two different columns?

SELECT COUNT(attr_id)
FROM pv_attribute
WHERE port_id = 322;
SELECT COUNT(attr_id)
FROM pv_attribute
WHERE port_id = 323;
How can I get these two results in two different columns?
Thanks

So Jens made a tiny mistake with the column name... shame you couldn't be bothered to research Pivoting so you could have corrected the mistake (possibly it was deliberate *{:-) ) and learnt something.
with pv_attribute as (select 16123 attr_id, 322 port_id from dual union all
                      select 16123 attr_id, 322 port_id from dual union all
                      select 19223 attr_id, 322 port_id from dual union all
                      select 11193 attr_id, 323 port_id from dual union all
                      select 13163 attr_id, 323 port_id from dual)
-- end of test data setup
select sum(decode(port_id, 322, 1, 0)) cnt_322,
       sum(decode(port_id, 323, 1, 0)) cnt_323
from   pv_attribute
where  port_id in (322, 323)

Similar Messages

Maybe you are looking for

  • GR for free goods

    HI, I have an scenario and pls advice Material Stock =10 STandar Price: =10 Rupees Stock value =10*10=100 If receive the 10 nos of material as free of goods.so now the value Material Stock =20 STandar Price: =10 Rupees Stock value =10*10=100 Now if i

  • Error code 1079 on windows 8.1

    I have just upgraded to windows 8.1 on my Lenovo ideapad yoga 13 and my audio has stopped working. All the fixes available discuss the older versions and none are able to support 8.1. Having researched this for the last 24 hours I have done most thin

  • Seeburger Message Catalogue - Need more messages

    Hi experts, very quick and simple question. The standard catalogue given with Seeburger MD/BIC doesn't have some of the messages I need e.g. INVOIC (D01B) and a few others. What is the best and quickest way to achieve this? I doubt if there are any f

  • Set default gateway on headless server (via ssh)

    I'm trying to configure one of the two ethernet interfaces on a headless Xserve. I managed to give it an address and subnet mask with ifconfig, but I can't figure out how to give it a default gateway or dns server. I tried using this: sudo route add

  • Export PDF, JPG or PNG images from the mapviewer

    hi, I need to export PDF, JPG or PNG images from the mapviewer (Oracle Map client). How Can I do it? Any Ideas? Thanks.