-
SQL Query to Retrieve single row.
I have a table as below
TX_ID Card No. Primary
127 XXXX1234 0
129 XXXX1234 0
1245 XXXX1234 1
1245 XXXX1234 0
1245 XXXX1234 1
Need to fetch the distinct of maximum of TX_ID value where the primary value is 1.
The out put should be
TX_ID Card No. Primary
1245 XXXX1234 1
-
You can use GROUP BY TX_ID, Card No. HAVING Primary=1
-
u can try it as below sql.
select distinct * from tableName where Primary = 1;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|