ÎÒÏÖÔÚÓÐÁ½¸ö±í
µÚÒ»¸ö±íΪ
id title content
1 34234 234234
µÚ¶þ¸ö±íΪ
id Tcontent time tab1ID
1 ¼ÎÁê½ 2009-1-1 1
ÔõÑù°Ñ±í¶þµÄtime¼ÓÈë±íÒ» È»ºóselectÅųötimeµÄÉýÐò
ÎÒÁ¬½ÓÁ½±í¶¼¸ãÔÎÁË Çë´ó´óÃǰï°ïæ
SQL code:
select *
from µÚÒ»¸ö±í a ,µÚ¶þ¸ö±í b
where a.id=b.tab1ID
order by b.time
SQL code:
select *
from µÚÒ»¸ö±í a inner join µÚ¶þ¸ö±í b on a.id=b.tab1ID
order by b.time
select *
from A1 a inner join A2 b on a.id=b.tab1ID
order by b.time
select a.*,b.time
from a , b
where a.id=b.tab1ID
order by b.time
select a.*,b.time
from ±í1 a inner join ±í2 b on a.id=b.tab1id
order by b.time
ÒÔÉÏ·½·¨¿ÉÒÔ²é³ö µ«ÊÇÈç¹û±í2ûÓмǼ ²éѯµÄ½á¹ûÊÇ¿Õ
ÓÐûÓа취²é³öÈç¹ûb.timeΪ¿Õ×Ô¶¯¼ÓÉÏ¡°¿Õ¡± È»ºó±í1µÄ¼Ç¼ÒÀÈ»ÏÔʾ°¡¡£¸÷λ°ï°ï棡£¡
Ïà¹ØÎÊ´ð£º
C# code:
System.Data.SQLite.SQLiteConnection conn = new SQLiteConnection(@"acs.db");
try
{
conn.Open();
}
......
ÈçÏÂÓï¾ä £º
select TimeSpan from T_Table where onlineDate = '2009-12-2'
Êý¾Ý¿âÀïÃæÓзûºÏÌõ¼þµÄÖµµ«ÊDz鲻³öÀ´
Èç¹û¸Ä³ÉÈçÏ£º
select TimeSpan from T_Table where onlineDate = '200 ......
sqlite ²éѯijһÊý¾ÝËùÔÚµÄÐÐÊý£º
ÆäÖÐÊý¾Ý±íÖÐûÓÐרÃűêʶÌõÊýµÄË÷ÒýÖµ£¬ÎÒÃǸù¾ÝÆäËûһЩ×ֶβéÕÒµ½Á˸ÃÊý¾Ý£¬ÏÖÔÚÐèÒª·µ»Ø¸ÃÊý¾ÝËùÔÚµÄÐÐÊý¡£
ÆäÖÐsqlite manager ÖÐÓÐÒ»¸örowid£¬µ«ÊÇÕâ¸ö²¢ÎÞ·¨· ......
string ConStr="data source=C:\ceshi.db;verson=3;password=123456";
SQLiteConnection MyConnection = new SQLiteConnection(ConStr);
try
{ ......
ÓõÄÊÇsqllite3£¬ÇëÎÊÔÚlinuxÏÈÈçºÎÓÃCÓïÑÔµ¼³öÊý¾Ý¿â°¡£¿
"µ¼³öÊý¾Ý¿â"ÊÇÊÇʲô£¿
½« tab_xx ÖеÄÊý¾Ýµ¼³öµ½Îļþa.txt
sqlite> .output a.txt
sqlite> select * from tab_xx;
sqli ......