-
SQL query
Hi,
I have a table storing data like this
Oid OKey OValue
1 Status Open
1 Priority 1
1 Name TTT
1 Location NYC
2 Status Open
2 Priority 2
2 Name TYY
2 Location WDC
3 Status Close
3 Priority 2
3 Name TYZ
3 Location WDC
Now, I need to write a query to fetch Oid’s with Okey Priority=”2” and Okey Location=”WDC”
Kindly suggest
-
Select * from table where (okey = 'Priority' and ovalue = '2') and (okey = 'Location' and ovalue = 'WDC')
-
1. SELECT * FROM TABLENAME WHERE Priority=2 AND Location='WDC'
-
In this case, Priority and Location are values in column okey. WDC and 2 are values of ovalue column.
-
Let me show your table structure with values
Its easier for me to expalin.
Cool
-
SQL query
Not knowing the database structure means that it will be impossible to give a precise answer, but in general
Open SQL Server Management Studio
Click the NEW QUERY button
Type USE <name of database>
Click Execute
Type SELECT FROM <name of table containing client list>
Click Execute
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
|
|