Langsung ke konten utama

SQL IN Operator

IN Operator

IN operator memperbolehkan kita untuk memilih secara spesifik beberapa value di dalam WHERE clause.


SQL IN Syntax

SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...);

Demo Database

Kita ambil contoh dari Northwind sample database.
Dibawah ini adalah bagian dari "Customers" table :

CustomerID CustomerName ContactName Address City PostalCode Country
1
Alfreds Futterkiste Maria Anders Obere Str. 57 Berlin 12209 Germany
2 Ana Trujillo Emparedados y helados Ana Trujillo Avda. de la Constitución 2222 México D.F. 05021 Mexico
3 Antonio Moreno Taquería Antonio Moreno Mataderos 2312 México D.F. 05023 Mexico
4
Around the Horn Thomas Hardy 120 Hanover Sq. London WA1 1DP UK
5 Berglunds snabbköp Christina Berglund Berguvsvägen 8 Luleå S-958 22 Sweden


IN Operator Example

SQL statement di bawah ini untuk memilih semua customer dengan City dari "Paris" atau "London" :

Example

SELECT * FROM Customers
WHERE City IN ('Paris','London'); 

Komentar

Postingan populer dari blog ini

Use X++ wildcard (LIKE and NOT LIKE) in X++ select statement

For x++ select statements:  select firstOnly batchHistory      where batchHistory.Caption  LIKE  "*Test*"  For x++ queries:  queryBuildRange.value(*Test*); Note the LIKE instead of a '==' and the wildcards inside of the quotations. All other combinations of wildcard usage will work here. This is the same functionality as what the users would put in the grid filtering(eg. '*TEST*' in the caption field filter on the batch tasks form).  However, if you want to find all Captions that do not have the word Test in them (NOT LIKE, !LIKE), you will have to modify the above example slightly.  For x++ select statements:  select firstOnly batchHistory      where  !( batchHistory.Caption LIKE "*TEST*" ) ;  For x++ queries:  queryBuildRange.value(!*Test*);

Format Label Tom Jerry (MS Word)

Setelah beberapa lama aku tidak membuat label undangan, tiba-tiba kemarin aku diminta untuk membuat label undangan Wisuda dengan menggunakan label merek Tom & Jerry (TJ). Harusnya sih menjadi tugas sekretaris panitia tapi karena yang bersangkutan ada tugas di luar kantor maka aku yang membereskannya. Mula-mula aku membuat format labelnya dengan cara manual, tapi untung ada pak Mulyadi (staf tata usaha) yang menyarankan aku untuk mengunduh format label yang telah ada di Internet. Mulailah aku browsing di google dan menemukan format label berbagai ukuran dari website Tom & Jerry di alamat berikut  http://tjlabels.com/en/download.html  (yang link ini agak rempong krn pake masukin nomor captcha-captcha-an). Sedangkan kalau yang link ini langsung pilih file ga pake nomor captcha-captcha-an ( http://tjlabels.com/assets/download/ ). Ternyata juga ada banyak berbagai blog yang menyediakan  link download seperti ini, tapi aku mem- posting  artikel ini ...

Cleanup Jobs AX 2012

Cleanup jobs in Dynamics AX 2012 can help delete old data that is not needed anymore, and this reduction in database size can improve performance. In Dynamics AX 2012, cleanup jobs are available across various modules to run manually or in a batch mode. It is important to note that these jobs should be run after enough analysis determines that the business doesn’t need this data in the future. Please be sure to discuss with business management before deleting old data used in transactions that is not required any longer. Dynamics AX 2012 adds data to various tables for staging/intermediate purpose and this staging/intermediate data can be deleted once the transaction has been posted such as Sales update history, Purchase update history data. Here is the list of cleanup jobs available in Dynamics AX 2012 along with brief descriptions. All of these cleanup jobs are available in module > Periodic > Cleanup section Module Job Description General Ledger Clean up...