Click here to Skip to main content
15,942,847 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to count unique records and other records get number of these uniques and other in table using SQL?
This my Query

SQL
SELECT hubCode,mawb,ConfToInvoice,viaCode  FROM tblViaDetails WHERE  viaFlag='0' AND flDate='2013/07/04'

SELECT COUNT(isConfirmed) AS isConfirm  FROM tblOutboundHeader WHERE isConfirmed='TRUE'  AND viaCode='463'

SELECT COUNT(isConfirmed) AS isdisConfirm FROM tblOutboundHeader WHERE isConfirmed='FALSE' AND viaCode='463'


I want SELECT hubCode,mawb,viaCode,isConfirm,isdisConfirm Because i want to bind datagridview this details.

am try this one
SQL
Select count (isConfirmed) As isConfirm   from   tblViaDetails INNER JOIN
                tblOutboundHeader ON tblViaDetails.viaCode = tblOutboundHeader.viaCode  group by isConfirmed

can't select a hubCode,mawb,viaCode details
Posted
Updated 7-Jul-13 22:28pm
v4
Comments
Maciej Los 8-Jul-13 4:31am    
Please, post example data (both tables). Use "Improve question" widget to update question.
Please, be more specific and describe why can't you select some data?

Try this.


SQL
SELECT  hubCode,
    mawb,
    viaCode,
    COUNT(CASE isConfirmed WHEN isConfirmed='TRUE'  AND viaCode='463' THEN 1 ELSE NULL END) isConfirmed,
    COUNT(CASE isConfirmed WHEN isConfirmed='FALSE'  AND viaCode='463' THEN 1 ELSE NULL END) isdisConfirm
FROM    tblViaDetails
    INNER JOIN
    tblOutboundHeader ON tblViaDetails.viaCode = tblOutboundHeader.viaCode
where   viaFlag='0' AND flDate='2013/07/04'
group by isConfirmed
 
Share this answer
 
Use something like this

SQL
select FK_DeviceID,DisplayOrder,IsActive from tbl_Mst_Banner
union
select COUNT(PK_BannerID),'' DisplayOrder, ''  IsActive  from tbl_Mst_Banner
union
select COUNT(FK_DeviceID),'' ,'' IsActive from tbl_Mst_Banner
GROUP BY ImageLink
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900