SQL Query: UNION Query Example – Yes No

User should have option New Students Only? DropDownList: Yes, No. We have a table from where we know only starting admission number of new students.

Say for example: New students starting admission number is 26500 that means all the new student’s admission number will be greater than 26500, old student admission could be anything greater than 0.

SELECT        ‘Yes’ AS Response, StartStudentID
FROM            vwPortalYear


SELECT        ‘No’ AS Response, 0 AS StartStudentID

Here, Response and StartStudentID is column name. Yes, 26500 and No, 0 are the two record.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s