Sqlite - efficient select count query

时间:2015-05-08 09:52:38

标签: sqlite count exists

I have a table in my database I do a Select all on:

#player-back{
    height:250px; 
    background:#0F0;
}
#p1{
    margin-top:50px;
    margin-left:80px;
}
#p2{
    margin-left:150px;
}
#p3{
    margin-left:200px;
}
#player-popup{
     
    background:orange;
        height:27px;
        width:85px;
        border-radius:10px;
        text-align:center;
        margin-left:50px;

}

I want to append a column that is true or false if there's a related column in anther table. I can do it with this:

   

<div id='player-back'>
        <img src='http://s6.postimg.org/su0e7812l/player1.png' id='p1'/>
        <img src='http://s6.postimg.org/afpv38orx/player2.png' id='p2'/>
        <img src='http://s6.postimg.org/h7ga63drh/player3.png' id='p3'/>
            <div id='player-popup'>
                <span>Player1</span>
            </div>
    </div>


 

But I don't want to have to count EVERY row in TableB to work this out as its ineffient. I essentially want an SELECT * FROM TableA; check instead of count.

How do I replace the SELECT *, (SELECT COUNT(Id) > 0 FROM TableB WHERE Id = TableA.Id) FROM TableA; with EXISTS?

Thanks!

2 个答案:

答案 0 :(得分:1)

Ah - just realised the answer to my own question

=MATCH("Name",Suppliers[#Headers],0)

答案 1 :(得分:1)

By using a String home = System.getProperty("user.home"); File f = new File(home + File.separator + "Desktop" + File.separator + "Testing" + File.separator + "Java.txt");

File f = new File(FileNameUtils.normalize(home + "/Desktop/Testing/Java.txt"));