ujjwalguptaofficial / JsStore

Simplifying IndexedDB with SQL like syntax and promises
http://jsstore.net/
MIT License
858 stars 110 forks source link

need help for advanced sql query #71

Closed akhilsingh005 closed 6 years ago

akhilsingh005 commented 6 years ago

I unable to execute "Or" condition with multiple "And" condition. For example: Where:{ customerId:22980, stockNumber:3, or:{ stockDescription:"3" } } so could you please tell me solution of this issue. Its urgent for me.

ujjwalguptaofficial commented 6 years ago

Hi there

Please check out this link - http://jsstore.net/tutorial/adv-sql-example/

Hope this helps you. Otherwise please drop ur sql query

On Wed 29 Aug, 2018, 8:15 PM akhilsingh005, notifications@github.com wrote:

I unable to execute "Or" condition with multiple "And" condition. For example: Where:{ customerId:22980, stockNumber:3, or:{ stockDescription:"3" } } so could you please tell me solution of this issue. Its urgent for me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ujjwalguptaofficial/JsStore/issues/71, or mute the thread https://github.com/notifications/unsubscribe-auth/AKbo9w98iPcg8Nx3Sse0J-46mMWiMqXFks5uVqkDgaJpZM4WRs5L .

akhilsingh005 commented 6 years ago

Its actualy not working in my case. My required sql query is-

select * from tbl1 where customerId=1 and categoryId=1 and SubCategoryId=2 and (stockNo=1234 or StockDescription like '%+searchText+%')

ujjwalguptaofficial commented 6 years ago

The query for above sql query will be -

select({
    from: 'table1',
    where: [{
        customerId: 1,
        categoryId: 1,
        SubCategoryId: 2
    }, {
        stockNo: 123,
        or: {
            StockDescription: {
                like: '%+searchText+%'
            }
        }
    }]
})

Let me know if its working for you. Thanks